[cairo] OpenGL backend news and a few words about shading

David Reveman c99drn at cs.umu.se
Sat Feb 28 14:14:10 PST 2004


Here's some info about latest additions to libglc and the OpenGL
backend:

Anti-aliasing is supported and implemented using the multi-sample
extension, this gives great results but will off course only work on
hardware with multi-sample support.

Many compositing operations can now be done using fragment programs.
This allow us to do composite with mask surface without an intermediate
buffer and gives a nice performance boost on hardware with fragment
program support.

Convolution filters - libglc can do convolution filtering using fragment
programs. 3x3 kernels are only supported right now but other sizes can
be added if useful. As it's done using fragment programs performance is
great.

Programmatic surfaces - also done using fragment programs are the
support for programmatic surfaces. Only two types of programmatic
surfaces supported this far, linear gradients and radial gradients. I
plan to add support for a function based gradient as well. See my
comments below about shading if you like to know how this has been
integrated into Cairo.

AGL (Apple GL) support - We have written an AGL backend for libglc. It
works just as good as the GLX backend and through this Cairo will have
native Mac OS X support. 

latest OpenGL backend patch for cairo along with some demo applications
are available from:
http://www.cs.umu.se/~c99drn/


Shading in Cairo
What I've done with the OpenGL patch is that I've added a new type of
surface called a cairo_gradient_surface (should probably be programmatic
or shading surface instead) which can be used with cairo_fill_pattern or
with cairo_show_surface. This way the backends can handle the gradients
in their own way or just request an image version of the gradient from
the gradient surface backend. You should have a look at the GL backend
if you would like to see how easy backends can do their own accelerated
gradients this way.

I think that inside Cairo this is a create way for handling programmatic
surfaces. Externally, there might be good to introduce a cairo_shader_t
object as Thomas Hunger did in his shading patch. A cairo_shader_t could
then only be set as fill pattern using the cairo_set_shader function.
This wouldn't be as confusing for the user as my
cairo_gradient_surface_t that appears as a normal surface but cannot be
set as current target surface.

/ David

-- 
David Reveman <c99drn at cs.umu.se>





More information about the cairo mailing list