GTK and OpenGL/Mesa



Hello,

I prepared a simple GTK/OpenGL working example that does not use GTKGLExt or GTKGLArea:

http://www.gamgi.org/gtk_opengl.tar.gz

Currently it only works on X, but I believe it could be easily extended to Mac OS X and Windows. It needs two headers: <GL/glx.h> (distributed with Mesa and available on any X system with OpenGL capabilities) and <gdk/gdkx.h> (distributed with GTK).

For comparison, I included also the corresponding version with GTKGLExt.

The GTK/OpenGL version has 146 lines and compiles and runs with -DGSEAL_ENABLE and *_SINGLE_INCLUDES, so in theory it should easily work with GTK 3.0.

The GTK/OpenGL/GTKGLExt has 109 lines and compiles with -DGSEAL_ENABLE but not with *_SINGLE_INCLUDES, because GTKGLExt is not yet GTK-3.0 ready.

I deliberately removed all error checks, to make this experimental code as simple and clear as possible.

I tested this on relatively new Ubuntu 9.10 (GTK 2.18.3) and relatively old Fedora 8 (GTK 2.12.8), in both cases it runs apparently fine, without warnings. A friend tested this on Puppy and Mandriva.

I did not test yet more complex things like creating and removing GLContexts while maintaining shared pre-compiled OpenGL lists, but I am reasonably confident that those things will probably work, as they are essentially OpenGL-specific features.

So, I would like to hear your comments and suggestions on this code: what mistakes am I doing? are there mem leaks? how to make it more robust? how to make it even more simple? is this a good ideia at all?

Regards,
Carlos



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