Using GLX_EXT_texture_from_pixmap for redirected rendering of widgets/windows.

Mirco Müller macslow at bangang.de
Thu Dec 20 08:03:36 PST 2007


Greetings xorg/gtk+-crowd!

	I finally got that "gtk+-widgets _ontop_ of a GL-context" working and
would like to get some input from anybody interested in the topic.

	Apart from toolkit-level input-redirection not working, which is likely
another big chunk of work to design and implement, I am mainly
interested in solving any possible GLXFBConfig-selection issues, people
might run into. Sofar I've only successfully tested it under
metacity/compiz on a GeForce-card and still battle to get it working on
an i965. On the side of rendering-performance I feel that I am still
missing some optimization in the way I do draw the widgets on quads,
because of a slight CPU-hit I experience here (mapping such a small
texture at a refresh of 20Hz or 60Hz should not be noticeable at all).

	The general approach used to get it going, is to stuff the widget(s),
which are loaded in from a glade-description, in a GtkEventBox, use
gdk_window_set_composited() on the GtkEventBox to redirect it to an
offscreen pixmap, select a matching GLXFBConfig derived from the
top-level GtkWindow and use GLX_EXT_texture_from_pixmap to finally
obtain a GL-texture from the widgets pixmap. All this is then drawn with
GL right into the top-level GtkWindow.

A screenshot of the examples running...

        http://macslow.thepimp.net/shots/gtk-examples-1.png

The source to the examples can be grabbed with...

        bzr branch http://bazaar.launchpad.net/~macslow/gtk-offscreen-1/trunk gtk-offscreen-1
        bzr branch http://bazaar.launchpad.net/~macslow/gtk-gl-offscreen-1/trunk gtk-gl-offscreen-1
        bzr branch http://bazaar.launchpad.net/~macslow/gtk-gl-offscreen-2/trunk gtk-gl-offscreen-2
        bzr branch http://bazaar.launchpad.net/~macslow/gtk-gl-rgba-1/trunk gtk-gl-rgba-1
        
Thanks in advance!

Best regards...

Mirco "MacSlow" Müller




More information about the xorg mailing list