Game Development Reference
In-Depth Information
Tip If you get stuck, the source for this project is under ch04.OpenGL2Shaders , available from
the publisher.
Now let's look at the files in more detail.
Manifest
Listing 4-4 is the XML file created by the wizard. The most important thing to remember is to
use the OpenGL ES 3.1 feature and set the required attribute to true .
Listing 4-4. Android Manifest for the Project
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.opengl.shader"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<uses-feature
android:glEsVersion="2"
android:required="true" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".ShadersActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
The next step is the main activity.
Main Activity
Listing 4-5 shows the main program ( ShadersActivity ) of the icosahedron application. It is
simple: when the application starts, the onCreate method is invoked. Within this method,
a ShadersView object is created and set as the content view. A set of arguments may be
passed to the C++ layer by invoking the setRenderer method with an array of strings.
 
Search WWH ::




Custom Search