[GtkGLExt] troubles with shareing display lists



Hi.
I'm working on a program in which I want to be able to load one copy of my textures and build one copy of my models and have multiple windows show these things.  I also want no restrictions on how windows might be opened and closed, in other words, I don't want to have a "master window" that holds the shared display lists, and if it is closed, all windows die.  About a year ago some code was posted on this list that was an attempt to accomplish this using an offscreen GdkGLPixmap to "hold" the display lists.  The code was similar to the following (which I am currently attempting to use):

I'm using an OO approach with gtk objects, btw.
In "gl-share" instance_init I have:

        priv->glconfig = gdk_gl_config_new_by_mode(GDK_GL_MODE_RGBA |
                               GDK_GL_MODE_DOUBLE |
                               GDK_GL_MODE_DEPTH |
                           GDK_GL_MODE_STENCIL);

        GdkPixmap *pixmap = gdk_pixmap_new(NULL, 8, 8, gdk_gl_config_get_depth(priv->glconfig));

        GdkGLPixmap *glpixmap = gdk_pixmap_set_gl_capability(pixmap, priv->glconfig, NULL);
   
        GdkGLDrawable * gdgld = gdk_pixmap_get_gl_drawable(pixmap);

    priv->share_list = gdk_gl_context_new(gdgld, NULL, TRUE, GDK_GL_RGBA_TYPE);

then in "gl-client-win" instance_init (maybe bad choice of name):

      gtk_widget_set_gl_capability (GTK_WIDGET(self),
                                   gl_share_get_gl_config(),
                                     gl_share_get_share_list(),
                                       TRUE,
                                     GDK_GL_RGBA_TYPE);

And the first gl-clie nt-win to be instanciated calls gl_share_create_lists() during its realize callback.  This code appears to work.  I can open new windows until my fingers hurt, with textures and models galore, but if I start to close some windows and open new ones, I quickly get to see the following backtrace in gdb:

Program received signal SIGSEGV, Segmentation fault.
0x0837fb3b in ?? ()
(gdb) backtrace
#0  0x0837fb3b in ?? ()
#1  0x0000007b in ?? ()
#2  0x0000007b in ?? ()
#3  0xb6a5f3b2 in __driGarbageCollectDrawables ()
   from /usr/X11R6/lib/modules/dri/r200_dri.so
#4  0xb6a5ff13 in driDestroyContext ()
   from /usr/X11R6/lib/modules/dri/r200_dri.so
#5  0xb77047f7 in DestroyContext () from /usr/X11R6/lib/libGL.so.1
#6  0xb77f1d2f in _gdk_gl_context_destroy (glcontext=0x8077230)
    at gdkglcontext-x11.c:109
#7  0xb77ce489 in gdk_gl_context_destroy (glcontext=0x8ab27b8)
    at gdkglcontext.c:119
#8  0xb7804548 in gtk_gl_widget_unrealize (widget=0x89155a8, private=0x8915208)
    at gtkglwidget.c:149
... etc etc ... 

I've stepped through the code a few times, and at this point I'm not sure if the bug is in my code (most likely) or gtkglext, and worse, I'm not sure how to find out.  I was hoping that someone who has implemented a similar sharing strategy, perhaps even the fellow who posted the GdkGLPixmap code snippet so long ago (wink, wink) might recognize this crash and know the answer... or at least have a working implementation and can advise me. 
Oh yes, in case it hasn't become apparent already, I'm not entirely an expert with X windows/Gtk/OpenGL programming, though I'm slowly getting better.
Any help will be greatly appreciated. 
Oh yes, and I'm glad that gtkglext is experiencing a reawakening!
thanks for listening
walter


Yahoo! Photos
Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.

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