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), 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.

0 0

Post a comment