OpenGL for Embedded Systems (OpenGL ES) is a lightweight version of OpenGL intended to bring portable and standard 3D graphics programming to a wide range of embedded systems. The term embedded system refers to a computer embedded in some device. Unlike a typical PC, where the computer's primary task is, well, computing, an embedded system is a computer that facilitates only the operation of the device it is embedded in. Examples of these types of devices are PDAs, cell phones with sophisticated graphics displays, medical and diagnostic devices, and automotive and avionic (airplane) displays. OpenGL ES is maintained by the Khronos Group, a consortium of media-centric companies, which is similar in some respects to the OpenGL Architecture Review Board (ARB). In fact, many of the member companies belong to both the ARB and the Khronos Group.
Basically, OpenGL ES is defined as a subset of OpenGL version 1.3, with a few additional extensions. This subset is further divided into two more “profiles”: the Common profile and the Common-Lite or Safety Critical profile. The Common profile is simply a subset of OpenGL functionality intended to make OpenGL smaller in terms of the number of commands and in the memory footprint required for implementation. Another goal is to eliminate functionality that does not make as much sense in the embedded space. The Common-Lite profile is a further reduction of the feature set intended for devices with even less memory or available resources. Also called the Safety Critical profile, it is also useful in cases in which safety certifications are made easier by a smaller API footprint and less code that must be rigorously tested.
OpenGL supports a wide range of data types, and many functions allow you to specify data in whatever data type is convenient. The first step in reducing OpenGL is to reduce the number of data types supported at the high end and allow some of the smaller data types to be used for operations where they were not used before.
The first data type to go is GLdouble
. The loss of this data type eliminates any function variations in OpenGL that supported double data types. Functions that are not eliminated altogether (see the following section) but use only doubles (glOrtho
, for example) are kept, but they are changed to accept floating-point or fixed-point parameters.
To make OpenGL smaller for embedded systems, a new data type was added. The GLFixed
data type is a fixed-point decimal number, and GLclampx
is the “clamped” version of GLfixed
. This type was added because the Common-Lite profile also eliminates GLfloat
. Floating-point math hardware is often not included on embedded systems, and removing the data type removes the memory and performance overhead of having to emulate floating-point math operations.
The GLbyte
, GLubyte
, and GLshort
function suffixes were also eliminated. This leaves only the command suffixes i
, f
, and x
, with f
also being eliminated from the Common-Lite profile function suffixes. You still can specify vertex and color data components as short or byte data types (but only in vertex arrays). The only exception is that color values may be specified as ubyte, but not as short. By using these smaller data types, you can reduce program size and data storage as well.
The OpenGL ES specification (included on the CD) is more about what is removed from OpenGL than what OpenGL ES contains. This means it is not possible to understand OpenGL ES operation outside an understanding of OpenGL. Essentially, for both the Common and Common-Lite implementations, the following pieces of functionality have been removed in their entirety:
Use of Begin
/End
for geometry specification (OpenGL ES uses only vertex arrays.)
Interleaved arrays or support for glArrayElement
Display lists
Evaluators
Color index mode
User-defined clipping planes
Line or polygon stippling
glRect
Imaging subset
Feedback
Selection
Accumulation buffer
Edge flags
glPolygonMode
The primitives GL_QUADS
, GL_QUAD_STRIP
, and GL_POLYGON
Attribute saving: glPushAttrib
, glPopAttrib
, glPushClientAttrib
, or glPopClientAttrib
Many other features of OpenGL ES are greatly reduced in their scope and functionality. OpenGL ES still provides limited support for specifying the current color, normal, and texture coordinates using fixed-point or floating-point forms of the commands glColor4
, glNormal3
, and MultiTexCoord4
. You use these functions, for example, when one of these states remains constant for an entire vertex array.
The full transformation pipeline is still mostly in place, but it works only with the newly specified subset data types (no doubles and so forth). OpenGL ES also does not support the transpose matrix, and the minimum depth of the modelview matrix stack has been changed from 32 to 16.
Only 2D textures are supported in OpenGL ES. Multitexture remains optional, but the GL_COMBINE
texture environment is not. There is no support for texture coordinate generation or cube maps. There is no support for texture borders or the wrap modes GL_CLAMP
or GL_CLAMP_TO_BORDER
. Also missing are texture proxies, the LOD clamping, and bias parameters. Finally, texture compression is supported, but you cannot read back a compressed texture, and you cannot use glTexImage2D
to compress an uncompressed image.
Most raster functionality is gone from OpenGL ES. The glPixelStore
function is still partially supported, but only for packing and unpacking texture data. You can still read pixels with glReadPixels
, but glDrawPixels
, glPixelTransfer
, and glPixelZoom
are not supported. Although glReadPixels
still exists, you cannot use it to read from the depth or stencil buffers. The glReadBuffer
, glDrawBuffer
, and glCopyPixels
functions were also dropped. Polygon offset is supported only in fill mode (glPolygonMode
is no longer supported anyway).
OpenGL ES must still support at least eight light sources, and two-sided lighting is still supported, although both sides must now have the same material properties (no difference between front and back material properties any longer). The only color material mode is GL_AMBIENT_AND_DIFFUSE
, and the secondary color and local viewer lighting models were dropped.
OpenGL ES is a lean-and-mean 3D API providing the bare minimum, but sufficient, features to meet the needs of 3D graphics programmers in the widely defined embedded systems marketplace. Programming for OpenGL ES requires an SDK for the target platform that contains information on how to create and use a 3D context for that device's screen. PC emulators for OpenGL ES are just becoming available at the time of this printing, and you can check the Khronos (www.khronos.org) Web site for a list of vendors supporting OpenGL and links to further developers' resources.