[Repost] Re: GdkGLPixmap troubles

View: New views
1 Messages — Rating Filter:   Alert me  

Parent Message unknown [Repost] Re: GdkGLPixmap troubles

by Jose Commins-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

    Lindley, I think I've just spotted what the problem may be.  In your
code you have this:

gboolean reshapeGL(GtkWidget *widget, GdkEventConfigure *evnt, gpointer
data)
{
GUIWindow* me = (GUIWindow*)data;

    There's a quirk in using the 'gpointer data' object in a GTK
function - it actually gets swapped in the stack if you do so, and is
*not recommended* :P.
    The best approach is to not use the 'gpointer data' at all; instead,
if you want to pass your user data to a GTK function, attach a GObject
to it like so - in this example I am attaching it to the window
containing the GL context:

    (-in place of setting the user data in your initialisation code-)
    g_object_set_data ((GObject *)theWindowWithYourGLContext,
"myUserData", &theActualData);

    And then use something like this to retrieve it:

gboolean reshapeGL(GtkWidget *widget, GdkEventConfigure *evnt, gpointer
data)
{
    GUIWindow* me = g_object_get_data ((GObject
*)gtk_widget_get_toplevel (widget), "myUserData")));

    In your reshape (and other) functions that need it.

Regards,
        Jose.
_______________________________________________
gtkglext-list mailing list
gtkglext-list@...
http://mail.gnome.org/mailman/listinfo/gtkglext-list