On the iPhone, the specific hardware solution that OpenGL ES runs on top of is called POWERVR. The company that makes this chip (Imagination Technologies, or ImgTec for short) has released a supplemental API that you can use to get the most out of its hardware. This API is free to use and available for download from http://www.imgtec.co...powervr-sdk.asp. You can find additional utilities for handling POWERVR at http://www.imgtec.co...r-utilities.asp.
Conceptually, there is no real difference between using the
PVRTMat4 structures versus the simple
float arrays OpenGL uses. In fact,
float is expected, we
can use a
PVRTVec3, and wherever a
float is expected, a
However, the PVRT structs also have overloaded operators, so we can do something such as this:
PVRTVec3 vecB = vecA * matrixA; //vector-matrix multiplication //or this PVRTVec3 vecC = vecA.cross(vecB); //cross-product
We will use the PVRT structs for convenience.
To take advantage of the POWERVR hardware, ImgTec has created the POD model format. It is a lightweight format that simply aligns the vertex, index, and texture data in the configuration expected by the iPhone’s OpenGL ES API.
Source code to use the format is available as part of
the PVRT SDK. The class is named
CPVRTModelPOD and it supports skeletal animation. To make using the
class easier, we have created a
Model class to wrap the
PowerVR class. You can view the code in
Model.mm from the
You may notice that we use
.mm files whenever we create classes that
use the PVRT code. The
tells Xcode to compile code with support for C++ syntax, which is
required for PVRT.
To make the POD format easy to use, ImgTec has provided plug-ins
for Maya and 3ds Max (two of the major modeling programs).
Simply load a model in one of the editors and use the PVRGeoPOD
plug-in to export the file as a
If the original model was associated with a texture file, the
.pod file will retain the same
The POWERVR hardware extends OpenGL to support decompression of the PVR format on the GPU hardware, making it a very efficient texture solution. For our game, we are using PVRTC4bb (PVRT compressed 4 bits per pixel).
Learn more about this topic from iPhone Game Development.
What do you need to know to create a game for the iPhone? Even if you've already built some iPhone applications, developing games using iPhone's gestural interface and limited screen layout requires new skills. Loaded with descriptive examples and clear explanations, iPhone Game Development provides everything from game development basics and iPhone programming fundamentals to guidelines for dealing with special graphics and audio needs, creating in-game physics, and much more.