Pro OpenGL ES for iOS
318 CHAPTER 10: OpenGL ES 2, Shaders, and...^ Now we’re ready to use our shaders, which turn out to be surprisingly straightforw ...
CHAPTER 10: OpenGL ES 2, Shaders, and... (^319) Figure 10-2. The daytime earth (left) vs. the nighttime earth (right) Under Open ...
320 CHAPTER 10: OpenGL ES 2, Shaders, and...^ glEnable(GL_DEPTH_TEST); m_EyePosition=GLKVector3Make(0.0,0.0,65.0); m_WorldModelV ...
CHAPTER 10: OpenGL ES 2, Shaders, and... (^321) glClearColor(gray,gray,gray, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFE ...
322 CHAPTER 10: OpenGL ES 2, Shaders, and...^ float nDotVP = max(0.0, dot(normalDirection, normalize(lightPosition))); colorVary ...
CHAPTER 10: OpenGL ES 2, Shaders, and... (^323) void main() { vec4 newColor; newColor=1.0-colorVarying; //1 gl_FragColor = textu ...
324 CHAPTER 10: OpenGL ES 2, Shaders, and...^ memcpy(&startData->xyz,vtxPtr,xyzSize); //geometry memcpy(&startData-&g ...
CHAPTER 10: OpenGL ES 2, Shaders, and... (^325) In line 1 allocate an array of structures to carry each of the components. Her ...
326 CHAPTER 10: OpenGL ES 2, Shaders, and...^ Figure 10-4. Earth seen from space as it reflects the sun Naturally we are going t ...
CHAPTER 10: OpenGL ES 2, Shaders, and... (^327) vec4 diffuseColor = vec4(1.0, 1.0, 1.0, 1.0); lightDirection=normalize(lightPosi ...
328 CHAPTER 10: OpenGL ES 2, Shaders, and...^ varying vec2 v_texCoord; uniform sampler2D s_texture; void main() { vec4 finalSpec ...
CHAPTER 10: OpenGL ES 2, Shaders, and... (^329) Figure 10-5. A close-up on the right of the earth/water interface Bring in the C ...
330 CHAPTER 10: OpenGL ES 2, Shaders, and...^ Not only are we going to add clouds to our model, but we’ll also see how to handle ...
CHAPTER 10: OpenGL ES 2, Shaders, and... (^331) [m_Sphere setBlendMode:PLANET_BLEND_MODE_SOLID]; [m_Sphere execute:m_EarthNightT ...
332 CHAPTER 10: OpenGL ES 2, Shaders, and...^ Here’s what is happening: Line 1 is merely declaring the new cloud_texture. In ...
CHAPTER 10: OpenGL ES 2, Shaders, and... (^333) This is just one very simple example of using a shader. When it comes to space t ...
334 CHAPTER 10: OpenGL ES 2, Shaders, and...^ Both the reflection and skybox are standard effects used often in games and elsewh ...
CHAPTER 10: OpenGL ES 2, Shaders, and... (^335) Figure 10-8. Hedly and his friends. They’re a quiet bunch. So, how is a cube map ...
336 CHAPTER 10: OpenGL ES 2, Shaders, and...^ With that in mind, let’s add cube map to the earth using GLKReflectionMapEffect. Y ...
CHAPTER 10: OpenGL ES 2, Shaders, and... (^337) m_Eyeposition.x=0.0; m_Eyeposition.y=0.0; m_Eyeposition.z=5.0; m_Earth=[[Planet ...
«
10
11
12
13
14
15
16
17
18
19
»
Free download pdf