This sample demonstrates how to use a texture atlas to draw multiple objects with different textures simultaneously using OpenGL ES.
It shows how to:
* create PVR textures in an Xcode project build phase using texturetool;
* load a PVR texture and display it using OpenGL ES;
* create interleaved (tightly packed) vertex array;
* join triangle strips together by adding in degenerated triangles;
* compute 3D transformations using matrices and homogeneous coordinates (x,y,z,1).
This sample also uses some unrelated techniques, including random number generators, and depth-sorted blended particle system.
iOS 4.0 SDK
iPhone OS 3.2 or later
Functions to do simple 4x4 matrix calculations, including matrix*matrix and matrix*vector.
The PVRTexture class is responsible for loading .pvr files generated by texturetool.
The EAGLView class is a UIView subclass that renders OpenGL scene. It demonstrates how to bind a texture atlas once, and draw multiple objects with different textures using one draw call.
The GLTextureAtlasAppDelegate class is the app delegate that ties everything together.
These are the pvr files generated from the butterfly.png image by the "Run Script" build phase.
CHANGES FROM PREVIOUS VERSIONS:
Changed deployment target back to iPhone OS 3.2 and added CFBundleIconFiles in Info.plist.
Upgraded project to build with the iOS 4 SDK.
Fixed a bug when running in the simulator.
Modified the script so that it works regardless where texturetool is installed.
Updated for iPhone OS 3.1. Use CADisplayLink as the preferred method for controlling animation timing, and fall back to NSTimer when running on a pre 3.1 device where CADisplayLink is not available.
Copyright (C) 2009-2010 Apple Inc. All rights reserved.