Pro OpenGL ES for iOS

(singke) #1

CHAPTER 3: Building a 3D World (^87)
As with the previous examples, let’s play around with some of the parameters and see
what happens. First let’s change the number of stacks and slices, from 10 to 20, in the
initGeometry method. You should see something like Figure 3-19.
Figure 3-19. The planet with double the stacks and slices
If you want your curved objects to look smoother, there are generally three ways:
„ Have as many triangles as possible.
„ Use some special lighting and shading tools built into OpenGL.
„ Use textures.
The next chapter will cover the second option. But for now, see how many slices and
stacks it takes to make a really smooth sphere. (It works best with an equal number of
both.) It really starts looking good at 100 each. For now, go back to 10 each when
finished with this exercise.

Free download pdf