Pro OpenGL ES for iOS

(singke) #1

298 CHAPTER 9: Performance ’n’ Stuff^


The images that work best when compressed are those with color palettes that rely
heavily on one or two parts of the spectrum. The more varied your colors, the harder it
will be minimize the artifacting. The image of Hedly works better than the earth’s texture
map, because the former is largely grays and greens, while the latter is composed of
greens, browns, grays (for the polar regions), and blue.

Figure 9-5. Texture (from left ot right): 32 bit, RGB565, RGBA5551, and RGBA:4444

Other Tips to Remember


The following are some useful tips to keep in mind:
„ Even though multisample antialiasing can be very useful in smoothing
out your images, it means sudden death in the performance
department, cutting frame rates by 30 percent or more. So, you must
really, really need to use it.
„ Avoid using GL_ALPHA_TEST. This was never covered, but it can also kill
performance as much as MSAA.
„ When going to background, make sure to stop the animation and
delete any easily re-created resources.
„ Minimize the use of any calls that return information from the system,
such as the glGet* family of methods, especially glGetError(). Many
of these will force any previous commands to execute before state
information can be retrieved.
„ Use as few lights as possible. Going down to only a single light (the
sun), by turning off the fill and the ambient lights, increased frame
rates by as much as 30 percent on my iPad 2.
Free download pdf