[Cairo] GL surface backend

David Reveman c99drn at cs.umu.se
Fri Nov 21 10:54:31 PST 2003

My name is David Reveman, and together with a friend of mine Peter
Nilsson I've been working on a GL surface backend for the cairo library
(we are actually doing this as our master thesis).

What we have done is to create an interface on top of OpenGL with the
same semantics as the Xrender protocol in the form of a library
currently called 'libglxc'. As the library has the same semantics as
Xrender a seamless integration with the cairo library has also been

We are no where near finished, but a link to a page currently hosting
the project can be found at the end of this mail. A version of libglxc
and a patch for cairo along with some test utilities and modified
cairo-demos can be found there.

Comments about libglxc:
It currently only works with GLX, however we plan to move out the GLX
specific code to a separate file, making it more portable (libglxc ->

libglxc uses pbuffers for offscreen drawing, however cairo will
fall-back to image buffers for those operations not supported by GLX
drivers (with pbuffers available all rendering operations are performed
by libglxc).

It's been developed on GNU/Linux-x86 with geforce graphics cards (using
binary nvidia drivers) so right now there might be problems getting it
working on other systems, sorry. 

Comments about the cairo patch:
Adds a cairo_glx_surface.c and cairo-glx.h. Look at the demos found at
the web page for how create and use glx surfaces.

The patch also adds surface backend function color_trapezoids which can
be used by backends to draw solid trapezoids. This allows for the GL
backend to draw solid trapezoids without using pbuffers.

Polygon anti-aliasing is currently turned off by default, this because
we haven't found a good way to do it so that it works the same on all

Due to temporary problems with transformations in libglxc, gradients are
not rendered correctly with cairo.

A word about performance:
A lot can surely be done to increase performance, however with a decent
graphics card the current implementation should perform quite well. Try
the cairobench program found at the web-site for trapezoid drawing speed

A lot more work need to be done, but within a few months we hope to have
a fully working GL surface for cairo. Comments, tips and suggestions are
much appreciated. 

Here's the link to the web-page.

David Reveman ( c99drn at cs.umu.se )
Peter Nilsson ( c99pnn at cs.umu.se )

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20031121/3491f1b6/attachment.pgp

More information about the cairo mailing list