[cairo-commit] [cairo-www] src/OpenGL.mdwn

Bryce Harrington bryce at freedesktop.org
Wed Oct 15 17:41:03 PDT 2014


 src/OpenGL.mdwn |   38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

New commits:
commit e36f7aa37fae08925c8ad84d35f87ab808121463
Author: Bryce Harrington <bryce at osg.samsung.com>
Date:   Wed Oct 15 17:40:24 2014 -0700

    opengl: Add some explanatory text about opengl vs. cairo from ickle
    
    This is from his message to the Cairo list from Oct 17, 2013.

diff --git a/src/OpenGL.mdwn b/src/OpenGL.mdwn
index 65cef71..1c5739a 100644
--- a/src/OpenGL.mdwn
+++ b/src/OpenGL.mdwn
@@ -10,6 +10,44 @@ tool-chain under Linux and some graphics-programming in
 general. Furthermore I want to point out, that I am not an native
 english speaker and cannot guarantee this text to be error-free.
 
+# What is OpenGL and how does it relate to Cairo?
+
+OpenGL is a low-level abstraction for feeding rendering primitives to
+the GPU. The base elements are triangles and shaders.
+
+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.
+
+Cairo is a much higher abstraction which is both an advantage and
+disadvantage:
+
+For the application programmer, a canvas api (e.g. cairo) is much
+simpler to use. You do not need to worry about GPU limitations and are
+device and display independent, using a layout language much closer to
+the graphic designers.
+
+Conversely, the abstraction of the canvas api divorces the application
+programmer from considering the limitations of the GPU and how poor they
+are at rendering the canvas model. In order to gain the most
+performance, you need to construct your UI fully cognisant of the GPU
+and program within its capabilities. That is highly device and driver
+specific.
+
+cairo - easy to use, portable to any device, scales to any device
+opengl - very hard to use (have to write your own toolkit), device
+         dependent. May be faster.
+
+To use OpenGL without Cairo, you essentially have to create your own UI
+toolkit, which if you desire the general qualities Cairo offers, ends up
+looking very much like Cairo, with similar advantages and disadvantages
+over raw OpenGL.  Where it is easiest to use OpenGL (for example
+blending multiple layers), it is also easy for Cairo to efficiently use
+OpenGL.
+
+
 # Typical benefits
 
 So why would you want to mix vector-graphics rendering, provided by


More information about the cairo-commit mailing list