Skip to content

Files

Latest commit

 

History

History

GLTextureAtlas

GLTextureAtlas

================================================================================
DESCRIPTION:

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.

================================================================================
BUILD REQUIREMENTS:

iPhone SDK 3.1 and later

================================================================================
RUNTIME REQUIREMENTS:

iPhone OS 3.1 and later

================================================================================
PACKAGING LIST:

Matrix4x4.h
Matrix4x4.c
Functions to do simple 4x4 matrix calculations, including matrix*matrix and matrix*vector.

PVRTexture.h
PVRTexture.m
The PVRTexture class is responsible for loading .pvr files generated by texturetool.

EAGLView.h
EAGLView.m
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.

GLTextureAtlasAppDelegate.h
GLTextureAtlasAppDelegate.m
The GLTextureAtlasAppDelegate class is the app delegate that ties everything together.

butterfly_2.pvr
butterfly_4.pvr
These are the pvr files generated from the butterfly.png image by the "Run Script" build phase.

================================================================================
CHANGES FROM PREVIOUS VERSIONS:

Version 1.1
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 Apple Inc. All rights reserved.