Menu

#5 X11 window initialization broken

open
nobody
None
5
2011-06-12
2011-06-12
No

This is how OpenGL initialization works in an X11 environment:

1. Select a visual that fits the needs of the application
2. Create a render context fitting to the visual
3. Create a window that uses the visual
4. make the created window and the opengl context current

What GLWidget misses is step 3. It doesn't create a window itself but uses the one created by GTK/GDK. There are cases where this seems to work. When requesting a standard R8G8B8 color format usually the standard visual X11 uses is exactly that. But it doesn't have to. For instance when requesting alpha support for the framebuffer in GLWidget the call to MakeCurrent fails with an exception on my system because the context cannot be bound to the window.

To fix this some drastic changes are needed. This is what I did to fix the issue:
-Derive directly from Gtk.Widget
-Overwrite OnRealize and create a window using the correct visual

Of course I can share my fixes but I changed a lot of things because of another bug I'll submit separately.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB