[cairo] New OpenGL backend merged
Chris Wilson
chris at chris-wilson.co.uk
Thu Jul 23 02:00:17 PDT 2009
On Thu, 2009-07-23 at 18:15 +1000, John C. Turnbull wrote:
> For a Cairo n00b like me, could someone explain exactly what an OpenGL
> back-end for Cairo is? Does it mean that all rendering is done using OpenGL
> or is it that 2D graphics rendering is done using Cairo and all 3D rendering
> done using OpenGL?
A backend for Cairo provides a means of rendering through the Cairo API
to a particular architecture. For example, to render to a PDF file, you
create a PDF surface which uses the PDF backend. Similarly for the other
vector file formats. For raster devices, i.e. your display or a pixel
buffer, everything is slightly more complicated due to the varied
hardware architectures and desire to interoperate with the various
libraries. The 'simplest' raster backend is the image backend which uses
pixman as a software compositor. Then we have the native backends such
as win32, quartz and xlib, which use the native windowing system to
provide acceleration wherever possible and we fallback to pixman when
not. More often than we would like, we have to fallback to pixman (or in
the case of xlib, the server has to fallback to pixman and is unable to
accelerate our request).
The promise of a direct rendering interface like OpenGL or DRM is that
we can issue commands to the GPU independent of the native windowing
system. This means we can completely bypass the partial support for
Cairo exposed through the native 2D API and implement acceleration for
any layer of Cairo - for example, offloading of high-quality
tessellation onto the GPU is a long desired goal. In the short term, it
means that we can actually provide h/w accelerated sampler (images,
gradients - as already demonstrated by glitz) and use the more efficient
rasterisation techniques that have not yet been propagated through
RENDER to the xorg drivers.
The other aspect of the OpenGL backend is that it will allow more
convenient interoperation of Cairo with OpenGL programs. Currently you
have to render to an image buffer and use that as a texture if you want
to take advantage of the Cairo inside you GL application. With the image
backend, you should be able to use cairo-gl to render directly using the
GPU into textures (or straight on to the framebuffer).
I hope that helps to clarify a few concepts. Keep having fun using
Cairo!
-ickle
More information about the cairo
mailing list