Re: [GtkGLExt] Sharing display lists + textures



I tried g_object_ref() etc on the GdkGLContext but it didn't help. After digging through the source code I think I know why: the OpenGL resources are released independently of the gobject, in the unrealize signal handler.

Now, I could of course prevent that signal handler from being called by registering my own, but that seems like it's a bit hackish. What I'd really like to do is create a context which simply doesn't go away. I've got plenty of other gtk widgets in the GUI which never disappear...but none of them needs OpenGL capability. Is it possible to OpenGL-enable a widget without actually changing how it's drawn?

I also looked into using a GdkGLPixbuf as the GdkGLDrawable for creating an offscreen context. While that compiled and didn't complain, the texture sharing does not appear to be working properly so far.

---- Jeff Eberl <jeffeb3 gmail com> wrote: 
> 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, "lindleyf cox net" <lindleyf cox net>
> 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
> > gtkglext-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtkglext-list
> _______________________________________________
> 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]