Re: [gtk-list] gtk-- and gl



Brian Alexander Martin <briam@cats.ucsc.edu> writes:
> The problem is that I need to find the GdkWindow structure associated with
> the Gtk_DrawingArea I want to render openGL to.  In the c version this was
> done by accessing the window element off of the drawing area.  The window
> element is in the _GtkWidget structure.  I was having problems figuring
> out how to do this with gtk--, and eventually I came up with the following
> beast:
> 
>         (((GtkWidget *)(((Gtk_Widget*)glarea)->gtkobject))->window)

GdkWindow *gdkwin=GTK_WIDGET(glarea->gtkobject)->window;
    
> What I had to do was to cast first to a Gtk_Widget * to get the gtkobject
> element (C structure) and then cast to a GtkWidget * (again C) to get to
> the window element.  This compiles and runs, but I don't get any openGL.

why do you need to cast to Gtk_Object? It should never be necessary.
(c++ does it automatically and ensuresx its safe..) 

Tho I'm not convinced its a problem with that part...

-- 
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --



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