Game Development Reference
In-Depth Information
■
Note
The original sample code will be modified to fit the changes described throughout this chapter.
Figure 5-1.
New Android project for the OpenGL sample
The Android cubes sample consists of the following Java classes (see Figure 5-2):
GLSurfaceView
: This is an implementation of
SurfaceView
that uses a dedicated
surface for displaying an OpenGL animation. The animation will run 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, we will be
rendering two tumbling cubes.
•
EglHelper
: This is a GL helper class used to do the following:
•