[cairo] glitztest and pbuffers
jonsmirl at yahoo.com
Wed May 26 18:41:59 PDT 2004
I'll dig through everything and try to figure out why it is making the
background surface current.
--- David Reveman <c99drn at cs.umu.se> wrote:
> glitz_surface_read_pixels (surface, &pixels);
> image = cairo_image_surface_for_data (pixels);
> pixman_drawing_operation (image);
> glitz_surface_draw_pixels (surface, pixels);
I think we need to hide the surface types from the application and just pass in
hints. So instead of glitz_glx_surface_create_for_window() and
glitz_glx_surface_create() you just call surface_create_for_window() and
surface_create_for_window() would work down a prioritized set of backends - glx,
xrender, xlib. You can use a hint to force one further down the list to the top,
but it's only a hint.
surface_create() would work the same. It would try pbuffer, pixmap, libpng.
surface_create_readonly() would be used for read only images and these would be
mapped directly to textures.
So in my case offscreen surfaces would automatically be made with pixmaps and
not do the read pixels/write pixels. The image would just stay a pixmap until
you copy it to the window surface or readonly_surface. It's not clear from your
example how often you read/write pixels.
Another solution that may work but I haven't tried is to use the backbuffer for
offscreen drawing. You copy the texture to the backbuffer, use the hardware to
draw on it, and then copy it back to the texture. Defer the copy back until
something else needs to use the backbuffer.
We're going to have to do something like this or Cairo apps are never going to
be portable. This would mean that glitz-glx.h, glitz-agl.h, glitz-miniglx.h
would never be used in applications.
You might want to look at the source for freeglut.
http://freeglut.sourceforge.net/. glut allows you to make simple portable
applications for GL by abstracting away the input device differences too. It
might be worthwhile to make a similar companion library for Cario. Of course
complex applications ignore glut.
jonsmirl at yahoo.com
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
More information about the cairo