- Home Startseite ホーム 主页 首頁
- SDK
- Dev Guide Handbuch Guía Guide Guida 開発ガイド 开发人员指南 開發指南
- Reference Referenz Referencia Référence Riferimento リファレンス 参考 參考資料
- Resources
- Videos ビデオ
- Blog ブログ 博客 網誌

Android.com

# OpenGL

Android includes support for 3D hardware acceleration. This functionality is accessed 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. Android currently supports OpenGL ES 1.0, which corresponds to OpenGL 1.3. So, if the application you have in mind is possible with OpenGL 1.3 on a desktop system, it should be possible on Android.

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.

For an example of this usage model (based on the classic GL ColorCube), see com.android.samples.graphics.GLView1.java in the ApiDemos sample code project. A slightly more sophisticated version showing how to use it with threads can be found in com.android.samples.graphics.GLSurfaceViewActivity.java.

Writing 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 http://www.khronos.org/opengles/.

Information specifically about OpenGL ES 1.0 (including a detailed specification) can be found at http://www.khronos.org/opengles/1_X/.

The documentation for the Android `OpenGL ES implementations` are also available.

Finally, note that though Android does include some basic support for OpenGL ES 1.1, the support is not complete, and should not be relied upon at this time.

↑ Go to top