[vtkusers] wglMakeCurrent failed: Thread error?

Tobias Mönch Tobias.Moench at Student.Uni-Magdeburg.DE
Tue Oct 11 02:42:12 EDT 2005


Hi Junior,

I had a similar problem using threads and trying to refresh with render(). For
me, the solution provided by this posting helped a lot:

http://public.kitware.com/pipermail/vtkusers/2004-April/073478.html

The idea is to create a timer that "stays" in the main thread from where you can
call render() without problems. It calls render() when a certain variable
becomes true. This variable should be global and is changed from one of the
other threads you are using.

Good Luck,
Tobias


Zitat von Junior Pilato <junior.pilato at gmail.com>:

> Hi Vtk users!!!!
>
> I'm developing an animation, and I'm using QVTK for
> provide user interface..
>
> I'm recentily post this message in Qt-interest lists:
> http://lists.trolltech.com/qt-interest/2005-10/thread00210-0.html
>
> And I'm tryed to solver this with QThread (thanks for help..).....but,
> again,
> I have other problem....
>
> When my application call render() function in my qthread object,
> VTK show this message:
> vtkWin32OpenGLRenderWindow: wglMakeCurrent failed in... ( sorry,
> I can´t read, application crash!)
>
> Wath's wrong???
>
>
> My code:
>
> class PlayThread : public QThread
> {
> public:
>
> PlayThread(){ play=true };
>
> void run();
>
> void stop();
>
> void SetAnimator( Animator *ms );
>
> void SetRenderer( vtkRenderer *r );
>
> private:
>
> volatile bool play;
>
> Animator *ani;
>
> vtkRenderer *rthread;
> };
>
> /********************/
>
> void PlayThread::run(){
>
> while (this->play)
> {
> this->ani->StartUpdate();
> this->rthread->GetRenderWindow()->Render(); // here occur the error...
>  }
>
> this->play = true;
> }
>
>
> void PlayThread::stop(){
> this->play = false;
> }
>
> .
> .
> .
> /*********************/
> // Main widget....
> void Viewer::play_simulation(){
>
> if ( !this->play_thread->isRunning() )
> this->play_thread->start();
> }
>
> void Viewer::stop_simulation(){
> if (this->play_thread->isRunning() )
> this->play_thread->stop();
> }
>
>
>
> Does somebody can help me ?
>
> Thanks a lot!!!
> Pilato Jr.
>






More information about the vtkusers mailing list