OpenGL in GTK+ design
- From: Josh Beam <josh joshbeam com>
- To: gtk-devel-list gnome org
- Subject: OpenGL in GTK+ design
- Date: Wed, 17 Sep 2003 19:00:07 -0500
Here are my ideas on the design of OpenGL support for GTK+. For those
that haven't seen it yet, you might want to download what I've coded
All that features right now is a GdkGL object that wraps Xlib/GLX.
The 'test' program features a viewport widget with the GL window
inside of it.
The basic goal is to have a GtkGL widget that can easily be created,
packed, and manipulated like any other GtkWidget. Something like this:
gl = gtk_gl_new(GDK_GL_RGBA | GDK_GL_DOUBLEBUFFER);
which can then be used like this:
gtk_gl_make_current(GTK_GL(gl)); /* not necessary if there's only one GtkGL being used */
... more GL stuff...
Of course there would also be functions for setting the depth size,
stencil size, and whatever else would be needed for OpenGL use.
At the lower level, there's a GdkGL object (early version is included
with the file I linked to above) that wraps calls to Xlib/GLX, or
Win32, or whatever library is used on a given platform that we want to
support. The gdk_gl_show() function is passed a GdkGL pointer and a
parent GdkWindow (which would usually be created by the GtkGL widget),
and then creates a GL window as a child of the parent GdkWindow.
That's basically it. The API would be pretty simple, as shown in the
example code above.
I've already started coding a GtkWidget, but it's not quite working
correctly yet; I'll include it with the next tarball of code I post.
Anyone have any comments?
Josh Beam <josh joshbeam com>
] [Thread Prev