Pro OpenGL ES for iOS

(singke) #1

CHAPTER 8: Putting It All Together (^253)
Figure 8-3. Zooming in and out using pinch gestures
Now we’re going to do the rotation support, which includes those quaternion things.
To the solar-system controller, add Listing 8-5 (and you can also get rid of the
lookAtTarget() stub). The helper function getPosition() for m_Earth is added in Listing
8-7, so don’t fret if you get the red dots-of-doom from 8-5.
Listing 8-5. New helper routines for the solar-system controller
-(GLKVector3)getTargetLocation
{
return [m_Earth getPosition];
}
-(void)lookAtTarget
{
GLKVector3 targetLocation=[m_Earth getPosition];

Free download pdf