Pro OpenGL ES for iOS

(singke) #1

CHAPTER 9: Performance ’n’ Stuff (^299)
„ A lot of the literature will recommend turning off ‘‘compile for thumb’’
in your build settings. The ‘‘thumb’’ that they are talking about is a
special 16-bit instruction set that the ARM processor can use to make
your executable smaller. It applies only to older devices, including
iPhones 1 and 3G and the first two generations of the iPod touch. So,
you will not likely see any improvement on the more recent units.
„ Do not access the frame buffer from the CPU. Calls such as
glReadPixels() should be avoided because they force the frame
buffer to flush all queued commands.


OpenGL Analyzer

Without a doubt, Xcode’s profiling application, Instruments, is one of the most powerful
debugging tools I have ever seen. And with Xcode 4, it is better than ever, adding a lot
of new tools for OpenGL ES applications. (I’ve already talked about Performance
Detective, but that is a separate application so not part of the actual Instruments
package covered here.)


You may already be familiar with some of the tools in the Instruments bulging toolbox for
tracking memory use, file I/O bottlenecks, and even WiFi activity. But the new OpenGL
ES analyzer should become your BFF------best (software) friend forever------for both the
depth and the breadth of the information it provides.


This will by no means be a comprehensive examination of the OpenGL ES Analyzer
within Instruments but will highlight some of its many features.


The analyzer uses Apple’s in-depth knowledge of the hardware and software both to
study the inner workings of OpenGL and to see how your application makes use of it, as
well as using an expert system to sniff out problems and possible cures. It hooks into
every call within OpenGL, tracking timing, duration, backtrace information, parameter
correctness, and much more. Note that only iPhones from 3GS and beyond and the
third-generation iPod/touch will work with the new tools.


Note As opposed to many of the tools within Instruments, the OpenGL analyzer will not work
on the simulator.
Free download pdf