I have done this before, and I asked this group about it. I found a method for increasing and decreasing the reference counts, and I just managed an extra reference count myself. Once I was done with the context, I removed my separately managed reference.
I think the commands I used were: gtk_widget_ref and gtk_widget_unref --Jeff On Apr 29, 2010, at 12:22 PM, "[email protected]" <[email protected]> wrote: > 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 > [email protected] > http://mail.gnome.org/mailman/listinfo/gtkglext-list _______________________________________________ gtkglext-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkglext-list
