OpenGL and GTK+


Once upon a time, kludge3d (and g3d before it) implemented OpenGL rendering via gtkglarea. gtkglarea (developed by J. Löf and originally hosted at – now a dead site) it provided a gtkdrawingarea like widget. Then some time goes by and gtkglarea seems to have gone unmaintained.

In the meantime, gtkglext had come into existence. So by the kludge3d 2003-07-18 release, gtkglext was the display option of choice. gtkglext offered the possibility of placing an OpenGL view onto any GTK+ widget. (Though I’ve never been convinced that you need to do that very often).

So then in 2008, I get my first Vista based laptop. At work, I’ve been internally maintaining a version of kludge3d for many years. I was disappointed that kludge3d only worked properly with desktop compositing turned off. It is not the end of the world sure, but it looks bad, and anyway, it should be fixable right? A quick look at the gtkglext source made it clear I didn’t really have the understanding of how gdk actually does anything on win32. With deadlines looming and the fact that my users were all on XP, I shelved further investigation.

Fastforward to now. Vista or Windows7 is in our corporate future. So while trawling the gtkglext mailing lists I see a post from Mike Farrell. He suggested enabling PFD_SUPPORT_COMPOSITION based on the information at Unfortunately the suggested patch didn’t work for me, but did get me digging into the gtkglext source code again. I worked out some of the path from GTK to the screen. gtkglext looks like it is violating the assumptions that DWM has about GDI and the OpenGL context.

Enter a new gtkglarea. ( It looks like it is being maintained again. And hey, it builds properly on windows with mingw out of the box. And better yet, all of the examples run properly with desktop compositing enabled. Woohoo.

So now the question is:

  • fix gtkglext
  • port kludge3d back to gtkglarea?