O'Reilly logo

OpenGL Insights by Christophe Riccio, Patrick Cozzi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Build Syndrome
Jochem van der Spek and Daniel Dekkers
44.1 Introduction
In the current age of desktop, mobile, and console computing, the number of plat-
forms, operating systems, and OpenGL versions that are in active use has become so
large that developing and deploying our application for all those different configura-
tions has become a trying and time-consuming part of development. When a game
studio wants to release its latest title on as many platforms as possible, it needs to
manage a combinatoric explosion of all the different configuration parameters.
We recognize two steps in the process to reduce the complexity of this task.
The first is to write OpenGL agnostic code, meaning that the code encapsulates the
platform- and OpenGL version–specific details into classes that are fully transparent
to any combination of platform and OpenGL version. The second method is to use
a metabuild system that wraps all that code into a usable project for many different
IDEs on many different platforms. Each platform comes with its own set of APIs for
creating a window to draw. Some of these APIs support OpenGL ES for embedded
systems, even on nonembedded desktop platforms such as the iPad simulator on OS
X, while some only support the OpenGL version that is enabled by the OpenGL
drivers on that platform. Different OpenGL implementations on various platforms
can be seen in Table 44.1. A complete list can be found on the OpenGL.org web-
site [Khronos 97]. A completely different way of achieving the same goal is to use
JavaScript with WebGL and is described in detail in Chapter 3. In this article we will
focus on C++/Objective-C.
635
44
636 VII Software Design
OpenGL(1.0–4.2) OpenGL ES(1.0/2.0)
OS X desktop GLUT, QT, wxWidgets, X11 QT
iOS embedded N/A CoreAnimation (iOS 2.0/3.0)
SGI desktop GLUT, QT, X11 EGL
Windows desktop GLUT, QT, wxWidgets, EGL EGL
Windows embedded N/A EGL, QT
Unix desktop GLUT, QT, wxWidgets, EGL EGL
Linux desktop GLUT, QT, wxWidgets, X11, EGL EGL
Linux embedded N/A EGL/QT
Android embedded N/A Android (1.0/2.2), EGL
Symbian embedded N/A EGL, QT
Blackberry embedded N/A BlackberryOS (5.0/7.0)
Web browsers N/A WebGL (ES2.0 only)
Table 44.1. Overview of the main OpenGL implementations on the various platforms.
As a demonstration, we show how to implement a very minimalistic OpenGL
program on a subset of all the possible platforms, as can be seen in Table 44.2.
For the sake of simplicity, we further limit ourselves to considering only APIs that
interface the creation of the so-called OpenGL drawing context, which specifies to
the operating system how a pixel is to be drawn to the screen. See [OpenGL 11] for
a more extensive discussion of this topic.
In describing the use of our selection of APIs on the subset of platforms, we
draw from the experience of writing the RenderTools [RenderTools 11] software li-
brary. The library was created over the course of the past three years (2008–2011)
to serve as a code base to create any conceivable OpenGL application on many dif-
ferent platforms. We tried to keep the classes lightweight: the library, in its sim-
plest form, depends as little as possible on external libraries. We used the whim-
sically named Extension Wrangler Library, or GLEW [Sourceforge 11], to manage
the various OpenGL extensions on each platform. Many deprecated math func-
OpenGL1.0–4.2 OpenGL ES 1.0–2.0
iOS N/A CoreAnimation(iOS 2.0/3.0)
Windows GLUT, QT, EGL EGL
OS X GLUT, QT N/A
Table 44.2. The selection of APIs and subset of platforms used in this article.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required