Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Cairo acelerated on Opengl backend?

Tags:

opengl

cairo

By this I mean, does Cairo draw lines, shapes and everything using opengl acelerated primitives or no? and if not, a library that does this?

like image 799
gotch4 Avatar asked Sep 16 '11 17:09

gotch4


People also ask

Does Cairo use OpenGL?

The Cairo GL backend allows hardware-accelerated rendering by targeting the OpenGL® ES API.

Does Cairo use GPU?

Cairo is a high-level canvas drawing model for laying out pages and other views. The base elements are resolution independent paths and patterns. Cairo can translate that canvas model into GPU primitives using OpenGL (among others), but the canvas model does not often translate efficiently to the GPU.


2 Answers

The OpenGL backend certainly accelerates some functions. But there are many it can't accelerate. The fact that it's written against GL 2.1 (and thus can't use more advanced features of 3.x or 4.x hardware) means that there is a lot that it simply cannot accelerate.

If you are willing to limit yourself to NVIDIA hardware, NVIDIA just came out with the NV_path_rendering extension, which provides a lot of the 2D functionality you would find with Cairo. Indeed, it's possible that you could write a Cairo backend for it. The path rendering extension is only available on GeForce 8xxx hardware and above.

It's nifty in that it's focused on the vertex pipeline. It doesn't do things like gradients or colors or whatever. That's good, because it still allows you the use of a fragment shader. Which means you get to do pretty much whatever you want ;)

like image 147
Nicol Bolas Avatar answered Nov 13 '22 00:11

Nicol Bolas


Cairo is designed to have a flexible backend for rendering. It can use OpenGL for rendering, though support is still listed as "experimental" at this point. For details, see using cairo with OpenGL.

It can also output to the X Window System, Quartz, Win32, image buffers, PostScript, PDF, and SVG, and more.

like image 27
Reed Copsey Avatar answered Nov 13 '22 00:11

Reed Copsey