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



On 20 Feb 1998, Tero Pulkkinen wrote:

> 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..)
>
Ok, so now I realize that those casts were not entirely necessary.  But
they shouldn't have been hurting anything either.

> Tho I'm not convinced its a problem with that part...
>
Neither am I.  I've been pouring through various header files trying to
sort this out and decided that I would avoid the plethora of macros that
live in the gdk/gtk header files just so I could tell what was going on
without looking up a bunch of different stuff.  (gdb won't expand
them either)

One interesting thing is that if I do a ptype GdkWindowPrivate from gdb it
gives me
    
(gdb) ptype GdkWindowPrivate
type = struct _GdkWindowPrivate {
    <incomplete type>
}
(gdb)

If I do it from the C version of glgtk it works:

(gdb) ptype GdkWindowPrivate
type = struct _GdkWindowPrivate {
    GdkWindow window;
    GdkWindow *parent;
    long unsigned int xwindow;
    Display *xdisplay;
    short int x;
    short int y;
    short unsigned int width;
    short unsigned int height;
    unsigned char resize_count;

...
 
This prompted me to go out and get the newest versions of gcc, egcs,
glibc, libstdc++ and gdb..

Has anyone else succeeded (or for that matter even tried) to do openGL
rendering via gtk--?

-Brian
    
   



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