Graphics >

3D with OpenGL

Android includes support for high performance 3D graphics via the OpenGL API—specifically, the OpenGL ES API.

OpenGL ES is a flavor of the OpenGL specification intended for embedded devices. Versions of OpenGL ES are loosely peered to versions of the primary OpenGL standard. Beginning with Android 2.2, the platform supports OpenGL ES 2.0 (with backward compatibility support for OpenGL ES 1.1). For information about the relative number of Android-powered devices that support a given version of OpenGL ES, see the OpenGL ES Versions dashboard.

The specific API provided by Android is similar to the J2ME JSR239 OpenGL ES API. However, it may not be identical, so watch out for deviations.

Using the API

Here's how to use the API at an extremely high level:

  1. Write a custom View subclass.
  2. Obtain a handle to an OpenGLContext, which provides access to the OpenGL functionality.
  3. In your View's onDraw() method, get a handle to a GL object, and use its methods to perform GL operations.

Several samples using OpenGL ES are available in the API Demos sample application.

A summary of how to actually write 3D applications using OpenGL is beyond the scope of this text and is left as an exercise for the reader.

Links to Additional Information

Information about OpenGL ES can be found at

Information specifically about OpenGL ES 1.0 (including a detailed specification) can be found at

The documentation for the Android OpenGL ES implementations are available in android.opengl and javax.microedition.khronos.opengles.

↑ Go to top

← Back to Graphics