Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Figure 8.1 shows a partially unfolded skybox and a screenshot of a scene rendered from inside the skybox. The skybox texture provides the illusion of a panoramic vista all the way to a horizon no matter how the point of view changes within the box.
Figure 8.1. Skybox illusion.
A skybox only uses 12 triangles, two for each of the six sides of the cube. OpenGL ES provides a special texture mapping mode called cube mapping to make effects like the skybox work. Each of the six cube sides has a mapped 2D texture. When rendering, OpenGL ES calculates each fragment color based on the 3D direction vector from the point of view to a location on the surface of the cube. The location on the surface of the cube then corresponds to S and T texel coordinates within a texture for one of the six sides. Chapter 3, “Textures,” explains S and T texel coordinates.