Mapping texture to 3D objects with the OpenGL ES 1.x API
Texture mapping is a technique that overlays an image onto an object's surface to create a more realistic scene. This recipe covers how to add texture in OpenGL ES 1.x.
Getting ready
Readers are recommended to read the Drawing 3D graphics and lighting up the scene with OpenGL ES 1.x API recipe before going through this one.
How to do it...
The following steps create an Android project that demonstrates mapping texture to 3D objects:
Create an Android application named
DiceG1
. 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.java
, andMyRenderer.java
under thecookbook.chapter4.diceg1
package.MyActivity.java
andMySurfaceView.java
are similar...