Re: [GtkGLExt] Sharing display lists + textures



I found this problem several weeks ago (I even complained on this list): shared lists only worked fine when the first window was still available.

Then I realized that it was indeed bad design of my own. You can create and destroy as many windows as you like, including the first window, and shared lists will work just fine, as long as you have always a valid window at any given moment (even this limitation could be worked out I believe, you would have to copy/save a valid GL context somewhere).

The trick is: when you create a new window, the context that you supply to share the lists, must be the context of a window that exists at that moment, not necessarily the context of the first window you created!

When you destroy the first window, its context cannot be used anymore to serve as a model, when new shared contexts are created. You must always supply a valid context, of a valid window! this works fine with all shared lists I use. I never tried with textures but I assume it should work the same way.

Specifically:
1) create window 1;
2) create window 2;  #shared lists work fine in windows 1 and 2
3) remove window 1;  #shared lists work fine in windows 1 and 2
4a) Wrong: create window 3 with context from window 1; #shared lists will work on window 2 but not on window 3! 4b) Good: create window 3 with context from window 2; #shared lists work fine in windows 2 and 3!

Best regards,
Carlos
At first glance, GtkGLExt supports a simple interface for sharing display lists and textures, which is nice. However, when I actually try to use it, I've run into several practical problems and I was hoping for some advice on ways to solve them.

I have a GUI which can contain a list of items to be viewed, and zero or more figure windows in which to view them. I use GtkGLExt to draw the items in the figure windows using OpenGL.

For efficiency, there are some things (texture downloads, display list generation) which I'd prefer to only do once the first time something is viewed, and then just re-use, even if the item is displayed in a different figure window, so it makes sense to share display lists + textures between the contexts underlying each GtkDrawingArea.

I've figured out a way to do it....provided the first figure window stays open. All the other figure windows share with the context from there. But if that figure closes, then any windows currently existing seem to be all right, but new ones created later don't handle the textures properly. The closed windows are not actually destroyed, merely gtk_widget_hide()en, but merely unrealizing them seems to be enough to destroy the GdkGLContext.

I've long thought that the biggest design flaw in OpenGL is the difficulty of creating a context without a window to attach it to. If I could just create a "window-less" context then I'd be fine, but that seems to be quite difficult using the GtkGLExt interface.

So my question is, first, has anyone encountered this type of problem before? And second, what actually happens when I share textures/display lists? If I create a texture in context A, then tell context B to share with A, then destroy context A, then create context C and tell C to share with B----will that texture be available to C or not?
_______________________________________________
gtkglext-list mailing list
gtkglext-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkglext-list




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