Game Development Reference
In-Depth Information
Listing 5-1.
Manifest File for This Chapter's Example
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="opengl.test"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon"
android:label="@string/app_name">
<activity android:name=".JavaGLActivity"
android:label="OpenGL Java">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".NativeGLActivity"
android:label="OpenGL Native">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="3" />
</manifest>
The following lines tell Android to create two application launchers in the device launchpad, one for
each of the activities OpenGL Java and OpenGL Native:
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Let's start with the Java-only implementation. Figure 5-3 defines the basic workflow of the OpenGL
application. The figure shows the main activity (
JavaGLActivity
), which creates the rendering surface
(
GLSurfaceView
). The surface creates a thread (
GLThread
) and renderer (
CubeRenderer
).
GLThread
contains
the loop that invokes the renderer
draw()
method that draws the tumbling cubes seen on the device
display.