Game Development Reference
In-Depth Information
The Android cubes sample consists of the following Java classes (see Figure 3-6 ):
GLSurfaceView : This is an implementation of SurfaceView that uses a
dedicated surface for displaying an OpenGL animation. The animation
runs in a separate thread ( GLThread ).
GLThread : This is a generic thread with a loop for GL operations. Its job
is to perform resource initialization. It also delegates rendering to an
instance of the Renderer interface.
Renderer : This is a generic interface for rendering objects. In this case,
you are rendering two tumbling cubes.
EglHelper : This is a GL helper class used to do the following:
Initialize the EGL context.
Create the GL surface.
CubeRenderer : This is an implementation of the Renderer interface to
draw the cubes.
Cube : This class encapsulates a GL cube, including vertices, colors, and
indices for each face.
Swap buffers (perform the actual drawing).
Because the sample needs to be slightly modified to illustrate the concepts of the chapter,
the following classes have been added for this purpose:
JavaGLActivity : This is the Android activity that starts the Java-only
version of the application.
NativeGLActivity : This activity starts the hybrid version of the sample
(with Java/C/JNI code).
Natives : This class defines the native methods used by this sample.
 
Search WWH ::




Custom Search