OpenGL ES is an industry standard for (3D) graphics programming. It is especially targeted at mobile and embedded devices. It is maintained by the Khronos Group, which is a conglomerate of companies including ATI, NVIDIA, and Intel, who together define and extend the standard.
Speaking of standards, there are currently three incremental versions of OpenGL ES: 1.0, 1.1, and 2.0. The first two are the ones we are concerned with in this book. All Android devices support OpenGL ES 1.0, and most also support 1.1, which adds some new features to the 1.0 specification. OpenGL ES 2.0, however, breaks compatibility with the 1.x versions. You can use either 1.x or 2.0, but not both at the same time. The reason for this is that the 1.x versions use a programming model called fixed-function pipeline, while 2.0 lets you programmatically define parts of the rendering pipeline via so-called shaders.
Many of the second-generation devices already support OpenGL ES 2.0; however, the Java bindings are currently not in a usable state (unless you target the new Android 2.3). OpenGL ES 1.x is more than good enough for most games, though, so we will stick to it here.
NOTE: The emulator only supports OpenGL ES 1.0. The implementation is a little shoddy, though, so never rely on the emulator for testing. Use a real device.
OpenGL ES is an API that comes in the form of a set of C header files provided by the Khronos group, along with a very detailed specification of how the API defined in those headers should behave. This includes things such as how pixels and lines have to be rendered. Hardware manufacturers then take this specification and implement it for their GPU on top of the GPU driver. The quality of these implementations varies a little; some companies strictly adhere to the standard (PowerVR) while others seem to have difficulty sticking to the standard. This can sometimes result in GPU-dependent bugs in the implementation that have nothing to do with Android itself, but with the hardware drivers provided by the manufacturers. I'll point out any device-specific issues along our way into OpenGL ES land.
NOTE: OpenGL ES is more or less a sibling of the more feature-rich desktop OpenGL standard. It deviates from the latter in that some of the functionality is reduced or completely removed. Nevertheless, it is possible to write an application that can run with both specifications, which is great if you want to port your game to the desktop as well.
So what does OpenGL ES actually do? The short answer is that's it's a lean and mean triangle-rendering machine. The long answer is a little bit more involved.
Was this article helpful?