wedding OpenGL with cairo

Without being in the midst of guadec anymore and finally able to concentrate again, I have fixed the example-hack I started in Vilanova, which was intended to show how one could go about using animated cairo-graphics as a source for dynamic texture-mapping in OpenGL. I also tried to use the new compositing-query function - gtk_widget_is_composited() - in gtk+ 2.10.x, but it turned out to be broken. At least it does not return true if I run under Xgl/compiz or Xorg/xcompmgr. The same error occurs with gtk+/tests/testgtk.c. Is this maybe a shortcoming of the used X11-server? Against which project should I file a bug now?

The presented hack, cleverly called gl-cairo-cube (although not really a cube), does not use the glitz-backend for cairo on purpose… for the moment. Just in case you wonder why your cpu is being hit hard during runtime. From now on I will put my examples, hacks and programs at my cozy spot at people.freedesktop.org. Over time I will move more and more of my stuff there. You can grab the current hack via…

git clone http://people.freedesktop.org/~macslow/gl-cairo-cube.git

If you are not running under a composited environment you will not see the nice transparency like shown in these screencasts, but get the typical black square in the background…



(click to play back, ogg/theora, ~2.9 MBytes)


(click to play back, avi/h.264, ~4.4 MBytes)

6 Responses to “wedding OpenGL with cairo”

  1. Peteris Krisjanis Says:

    Damn, this is man something very sexy :) Looks promising… I can imagine lot of applications who could take very big use of this.

  2. Elijah Says:

    Against which project should I file a bug now?

    Against both xcompmgr and compiz; the gtk+ implementation relies on a new hint introduced to the EWMH (see http://mail.gnome.org/archives/gtk-devel-list/2006-April/msg00117.html and http://mail.gnome.org/archives/wm-spec-list/2006-April/msg00004.html) which compositing managers should support. compiz will probably add it shortly; at the metacity/compiz small discussion group at GUADEC the new EWMH hints for compositing were brought up and David said he would add them to compiz soon.

  3. FunkyM Says:

    The latest git compiz version has the new hint support. This also makes the latest gnome-terminal work with the real transparency stuff using compiz ;)

  4. MacSlow Says:

    @ FunkyM: I’m running the newest compiz now. I also have a local install of gtk+-2.10.x and have made the upcoming version of cairo-clock 0.4.0 adapt to those new features (gdk_is_screen_composited). I’ll also update my slew of little demo-programs at http://people.freedesktop.org/~macslow to this when I find the time.

  5. Dux Says:

    Hi, I am in big trouble getting git to work. Can you please send sources as gziped tarball? Thank you.. I want to try it on AIGLX & Beryl

  6. MacSlow Says:

    @ Dux: Automatically generated tarballs are available now at http://people.freedesktop.org/~macslow

Leave a Reply