Pro OpenGL ES for iOS
218 CHAPTER 7: Well-Rendered Miscellany^ This demo has 24 such objects. Figure 7-6 shows the result. Figure 7-6. Simple lens fla ...
CHAPTER 7: Well-Rendered Miscellany (^219) Figure 7-7. Reflections in Distant Suns. (Yes, it is a gratuitous plug.) Of course, A ...
220 CHAPTER 7: Well-Rendered Miscellany^ Essentially, you render something to the stencil buffer as you would to any other, but ...
CHAPTER 7: Well-Rendered Miscellany (^221) Line 4 calls our rendering function, pretty much as you would normally call it. In ...
222 CHAPTER 7: Well-Rendered Miscellany^ 0.5, 0.0, -.5f, -0.5, 0.0, 0.5, 0.5, 0.0, 0.5 }; static const GLubyte colors[] = { 255, ...
CHAPTER 7: Well-Rendered Miscellany (^223) static const GLfloat cubeVertices[] = { -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,-0.5, 0.5, ...
224 CHAPTER 7: Well-Rendered Miscellany^ glEnable(GL_CULL_FACE); glCullFace(GL_BACK); glMatrixMode(GL_MODELVIEW); glLoadIdentity ...
CHAPTER 7: Well-Rendered Miscellany (^225) glPopMatrix(); spinY+=.25; transY += 0.075; } And here’s the breakdown: In line 1, ...
226 CHAPTER 7: Well-Rendered Miscellany^ Figure 7-8. Using stencils to create reflections Coming of the Shadows Shadow casting h ...
CHAPTER 7: Well-Rendered Miscellany (^227) Shadow Mapping At one time, one of the most popular forms of shadow casting was throu ...
228 CHAPTER 7: Well-Rendered Miscellany^ This is done in three stages. The first pass is to render the image only with ambient l ...
CHAPTER 7: Well-Rendered Miscellany (^229) Blob Shadows Blob shadows are a total cheat. It simply assumes that there is no real ...
230 CHAPTER 7: Well-Rendered Miscellany^ Figure 7-11. Projection of a shadow on a flat plane that is then ‘‘reprojected’’ out to ...
CHAPTER 7: Well-Rendered Miscellany (^231) m_SpinX=0.0; m_SpinY=0.0; m_SpinZ=0.0; m_WorldZ=-6.0; //2 m_WorldY=-1.0; m_LightRadiu ...
232 CHAPTER 7: Well-Rendered Miscellany^ glDisable( GL_LIGHTING ); //4 glLoadIdentity(); glTranslatef(0.0,m_WorldY,m_WorldZ); // ...
CHAPTER 7: Well-Rendered Miscellany (^233) m_SpinX+=.4f; m_SpinY+=.6f; m_SpinZ+=.9f; return; } So, what’s going on here? Well, s ...
234 CHAPTER 7: Well-Rendered Miscellany^ O K , t a k e a d e e p b r e a t h -----we have more to cover. Listing 7-13 demonstrat ...
CHAPTER 7: Well-Rendered Miscellany (^235) We need to add a floor or platform underneath the cube that the shadow will render up ...
236 CHAPTER 7: Well-Rendered Miscellany^ Nothing special here in line 1, but instead of describing the square in the x-y plane ...
CHAPTER 7: Well-Rendered Miscellany (^237) Figure 7-12. Z-fighting between the platform and the shadow Now we get to the real fu ...
«
7
8
9
10
11
12
13
14
15
16
»
Free download pdf