Drawing 3D graphics and lighting up the scene with the OpenGL ES 1.x API
This recipe covers how to draw 3D objects, handle touch events, and lighten up the objects in OpenGL ES.
Getting ready
Readers are recommended to read the introduction and the Drawing 2D Graphics and Apply Transforms with OpenGL ES 1.x API recipies below before going through this one.
How to do it...
The following steps show how to develop our sample Android project:
Create an Android application named
CubeG1
. Set the package name ascookbook.chapter4.gl1x
. Please refer to the Loading native libraries and registering native methods recipe in Chapter 2, Java Native Interface, if you want more detailed instructions.Right-click on the project CubeG1, select Android Tools | Add Native Support.
Add three Java files, namely
MyActivity.java
,MySurfaceView
, andMyRenderer.java
, under thecookbook.chapter4.gl1x
package.MyActivity.java
is the same as used in the previous recipe.MySurfaceView.java
extendsGLSurfaceView
with the code...