Pro OpenGL ES for iOS
CHAPTER 3: Building a 3D World (^57) if (!self.context) { NSLog(@"Failed to create ES context"); } GLKView view = (GLKView )self ...
58 CHAPTER 3: Building a 3D World^ glVertexPointer(2, GL_FLOAT, 0, squareVertices); //13 glEnableClientState(GL_VERTEX_ARRAY); g ...
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 ...
60 CHAPTER 3: Building a 3D World^ Going Beyond the Bouncy Square Now let’s change the preceding example to add a third dimensio ...
CHAPTER 3: Building a 3D World (^61) Listing 3-3. Defining the 3D Cube static const GLfloat cubeVertices[] = //1 { -0.5, 0.5, 0. ...
62 CHAPTER 3: Building a 3D World^ Figure 3-5. Notice the various axes: X going right, Y is up, and Z is toward the viewer. Some ...
CHAPTER 3: Building a 3D World (^63) chances are it is already optimized for one of the approaches, but if you really want to ha ...
64 CHAPTER 3: Building a 3D World^ Figure 3-7. The first triangle fan shares vertex 1 as the common vertex. Stitching It All Tog ...
CHAPTER 3: Building a 3D World (^65) glEnable(GL_CULL_FACE); //3 glCullFace(GL_BACK); // glMatrixMode(GL_PROJECTION); //4 // glL ...
66 CHAPTER 3: Building a 3D World^ Note “Windingness” is based on the direction the vertices describe. The first triangle formed ...
CHAPTER 3: Building a 3D World (^67) Defining the Frustum The last step we need is to specify details on how the vertices are ma ...
68 CHAPTER 3: Building a 3D World^ Here is what is happening: Lines 1 and 2 specify the distances of the near and far clipping ...
CHAPTER 3: Building a 3D World (^69) Any OpenGL call must have a current context to work, so it needs to be set ahead of everyth ...
70 CHAPTER 3: Building a 3D World^ Figure 3-8. Translation first, rotation second Here is what should be causing the sudden outb ...
CHAPTER 3: Building a 3D World (^71) However, in reality, the order of transformations is actually applied from last to first. N ...
72 CHAPTER 3: Building a 3D World^ immediately as called. Following is the same transformation sequence, but in OpenGL ES 2: bas ...
CHAPTER 3: Building a 3D World (^73) Figure 3-11. Scaling before the rotations have been executed (left) and scaling after the r ...
74 CHAPTER 3: Building a 3D World^ zFar from 1000 down to 1.5. Why? Remember that the cube’s local origin is 2.0 and its size is ...
CHAPTER 3: Building a 3D World (^75) Figure 3-13. The zFar plane is reset, while the zNear plane is moved back to clip any part ...
76 CHAPTER 3: Building a 3D World^ Figure 3-14a,b,c. Moving the object away (left) and then zooming in on it (center). The right ...
«
1
2
3
4
5
6
7
8
9
10
»
Free download pdf