Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The OpenGL ES lighting simulation incorporates three distinct components of each light source: ambient light, diffuse light, and specular light. Programs separately configure the color of each component. The effect of each component of simulated light is shown in Figure 4.2. Ambient light comes from all directions and therefore illuminates all geometry equally. Programs specify the color and brightness of simulated ambient light to set the base level of background lighting in a scene. The color of the ambient light tints all geometry, so a red ambient light makes all geometric objects in a scene appear red or pink. The diffuse component of each light source is directional and lights each triangle in the scene based on the orientation of the triangle relative to the direction of the light. If the plane of a triangle is perpendicular to the direction of the light, the diffuse light directly hits the triangle and is scattered intensely, which makes the triangle appear brightly lit. If the plane of a triangle is....