June 2013
Intermediate to advanced
346 pages
8h 42m
English
In the accompanying online resources for this chapter, you’ll find the example cube map separated into six separate textures in the /res/drawable-nodpi/ folder, one for each face of the cube. Let’s add a new method to our TextureHelper class to load these textures into an OpenGL cube map. We’ll call this method loadCubeMap, and we’ll start off with the following code:
| Skybox/src/com/particles/android/util/TextureHelper.java | |
| | public static int loadCubeMap(Context context, int[] cubeResources) { |
| | final int[] textureObjectIds = new int[1]; |
| | glGenTextures(1, textureObjectIds, 0); |
| | |
| | if (textureObjectIds[0] == 0) { |
| | if (LoggerConfig.ON) { |
| | Log.w(TAG, "Could not generate a new OpenGL texture ... |
Read now
Unlock full access