[GtkGLExt] Multithreading vs glXMakeCurrent()



Hi out there,

I have a strange multi threading problem using GtkGLextmm. Thread 1 creates a 
Gtk::GL::DrawingArea, does some initialization. Then Thread 1 (regular 
Actualisation) and Thread 2 (which handles all GTK Events) want to update 
things. But Thread2 cannot get a the start operations with 

Glib::RefPtr<Gdk::GL::Context> context=m_glDrawingArea->get_gl_context();
Glib::RefPtr<Gdk::GL::Drawable>  drawable=m_glDrawingArea->get_gl_drawable();
drawable->gl_begin (context); // fails

At the console I receive just:
 GdkGLExt-WARNING **: glXMakeCurrent() failed

But this happens only to Thread2. Sometimes the situation is changed and only 
Thread 2 can paint. All OpenGL code fenced with a Lock so that only one 
Thread can do OpenGL actions at once. I think it's possible to put all the 
drawing commands into a third thread (and let Thread 1 and 2 call them for 
repainting operations) but before I do that I want to ask if someone has 
another idea?


According to the man page glXMakeCurrent() should generate an error when it 
fails, but I don't receive one (at least nobody kills my program, which seems 
usual on X11 errors without error handler).

Single threaded OpenGL seems to work, OS is a Gutsy AMD64 with current nVidia 
Drivers 169.09 on a Geforce8.

Greetings from France,
Norbert


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]