Pro OpenGL ES for iOS

(singke) #1

86 CHAPTER 3: Building a 3D World^


Listing 3-11. The new drawInRect for the Solar System


  • (void)glkView:(GLKView *)view drawInRect:(CGRect)rect
    {


glClearColor(0.0,0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

[m_SolarSystem execute];
}
Finally, add in setClipping() (used in the previous exercise), making sure you’ve reset the
FOV to 50 or 60 degrees; modify the headers as needed; and compile. You should see
something like Figure 3-18.

Figure 3-18. The future planet Earth

It is actually rotating but, because it has no features at all, you’ll be hard-pressed to see
the motion.
Free download pdf