[cairo] cairo with open GL backend

Uli Schlachter psychon at znc.in
Sun Nov 21 02:18:38 PST 2010


Am 21.11.2010 00:09, Steve Harrington wrote:
> On 11/20/2010 02:20 PM, Luca Barbato wrote:
>> On 11/19/2010 01:54 PM, guhan senthilkumar wrote:
>>
>>> Oh like that. Ok Ok.. :)
>>> I have driver support for my GPU..
>>>
>>> Do you have a working example with openGL backed.??
>>> Or just please help me get started with writing the most simplest of
>>> applications with cairo and openGL backend. :) :)
>>>
>> http://cgit.freedesktop.org/~anholt/cairogears might help.
>>
>> lu
>>
>>
> Helps a lot. Looking at the boilerplate I thought I must have been
> mistaken to see so many raw Xlib calls but it seems that is the way this
> backend is designed to be used.
>
> I do have one problem with cairogears however.  I get an error
> (cairogears.c line 364) when I run the program:
>
> LD_LIBRARY_PATH=$PREFIX/lib ./cairogears -gl GRAD
> error constructing context: the surface type is not appropriate for the
> operation
>
> although the gears window is drawn but not updated if I comment out the
> exit(1) on line 367.  If this is something obvious please let me know.
> If not I'll probably run into it again as I adapt this code for my own use.

I took a look at this. The cairo_gl_surface_set_size call on line 369 causes a
CAIRO_STATUS_SURFACE_TYPE_MISMATCH. Anyone got any idea why? Just commenting
that line out makes it work (as long as you don't resize the window).

Also, just for the fun of it, I added support for cairo's xcb backend (Ugly
patch attached). It's ugly, but I wanted to see if there was some difference in
speed between xcb and xlib. There isnt, but both are faster than gl here.

Cheers,
Uli
-- 
Q: Because it reverses the logical flow of conversation.
A: Why is putting a reply at the top of the message frowned upon?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cairogears-xcb.patch
Type: text/x-diff
Size: 3696 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20101121/9bfb7295/attachment.patch>


More information about the cairo mailing list