Pro OpenGL ES for iOS

(singke) #1

CHAPTER 8: Putting It All Together (^287)
Figure 8-11. Distant Suns with custom date wheel on the left side yet with a standard UIKit toolbar at the same
time
Early on, Apple did caution about mixing the two worlds for performance reasons, in
particular when the practice was to use an NSTimer to drive the rendering loop. With the
addition of CADisplayLink with iOS 3.1, things got much better. There are a number of
other best practices to keep in mind:
„ Disable any OpenGL rendering loops if the view is hidden or the app is
pushed to the background.
„ Disable any OpenGL view if performing full-screen core animations.
„ The simpler the dialog windows, the less of a performance hit on the
OpenGL graphics.
„ Use transparency sparingly, in particular if your OpenGL view is
on top.
See? Sometimes the easy way can be the best way.


Summary

In this chapter, we took many of the tricks learned in previous chapters and combined
them into a more complete and more attractive solar-system model. A one-planet solar
system is not that impressive as it stands. So, I’ll leave it up to you, dear reader, to add
the moon, add some other planets, and get the earth to revolve around the sun.


Furthermore, we covered several other topics and tricks in past that I couldn’t get
around to adding to the project. For example, FBOs could be used to insert a secondary
view of the earth from a different angle in the screen.

Free download pdf