June 2013
Intermediate to advanced
346 pages
8h 42m
English
Our first task will be to load data from an image file into an OpenGL texture. To start out, let’s create a new class in the com.airhockey.android.util package called TextureHelper. We’ll begin with the following method signature:
| AirHockeyTextured/src/com/airhockey/android/util/TextureHelper.java | |
| | public static int loadTexture(Context context, int resourceId) { |
This method will take in an Android context and a resource ID and will return the ID of the loaded OpenGL texture. To start off, we’ll generate a new texture ID using the same type of pattern as when we’ve created other OpenGL objects:
| AirHockeyTextured/src/com/airhockey/android/util/TextureHelper.java | |
| | final int[] textureObjectIds = new ... |
Read now
Unlock full access