Pro OpenGL ES for iOS

(singke) #1

CHAPTER 3: Building a 3D World (^59)
„ Lines 13ff are similar to those in setupGL() in Listing 1-1, in that they
tell OpenGL how much data we have of what type and where it can be
found. glVertexPoint() hands off a pointer to the vertex array (see lines
5ff) and says that it has only two float values. Then the call
glEnableClientState(GL_VERTEX_ARRAY) tells the system to make use
of the vertex data. The next two lines do the same thing for the color
array.
„ Now draw things in line 14, and give us some metrics in line 15.
If it works, you should see something like Figure 3-4.
Figure 3-4. And the square goes bounce!

Free download pdf