3
votes

I have to create a cross-platform (Windows, OS X, Linux) OpenGL application and I have been looking for a good 2D graphics library without lot of fancy stuff (so SDL, QT, Juce are out of my business). I found Cairo and it seems to be great for my scope.

Since now I used to create an image context and then swap the surface on a texture in order to use Cairo with OpenGL, but I was wondering if there is a native and maybe faster way to do it. I read something about cairo-gl context, but I didn't understand if it is still in a beta stage, it seems not officially documented and anyway there is few documentation about it.

Furthermore I wasn't able to compile Cairo with the GL support (using --enable-gl option and making some hacks to fix some issues to the configure script) on OS X 10.10, so I cannot even test the few basic examples available on OS X.

Have you ever used it? Do you know where I can find some updated documentation? Or maybe do you know which is the best way (I mean: supported, portable and fast) to use Cairo with OpenGL?

1
It looks quite good, very small, easy to compile (just one command line), my only concernment is that it seems to be quite unpopular, so it may be hard to find support and documentation. Anyway I will try to use it in case I cannot find something more supported.Kill KRT

1 Answers

1
votes

Yes, and here is an example, it is full of bugs though and might soon be removed.

As for the best way to use it, don't use the backend at all, as it can cause a crash. It will also mess up your GL state.

Note, that you almost always need a special build of cairo, that has the GL backend enabled. A valid question these days is why use cairoat all, alternatives abound: NanoVG, ThorVG, blend2d ...