334 CHAPTER 10: OpenGL ES 2, Shaders, and...^
Both the reflection and skybox are standard effects used often in games and elsewhere.
The skybox is very useful in flight simulators so you can look anywhere and be
immersed in the artificial world.
GLKReflectionMap
Sometimes called environment mapping, reflection mapping is used to make an object
look like it is made out of the most polished metal or glass. Because it is cool-looking
and relatively easy, it is commonly found in games and elsewhere.
The reflection effect largely comes from having a fixed texture with some geometry
moving or rotating underneath. That means the texture coordinates for the reflective
surfaces will vary dynamically to counteract any motion the underlying object might
have.
The texture most commonly used as the ‘‘environment’’ typically comes in the form of
what’s called a cube map. A cube map is simply a texture that can be subdivided into
six squares and then reassembled in cube form around the reflecting object. Why a
cube instead of a sphere? Less fuss, mainly, unless you like fuss and want a reflected
texture as pure and distortion free as possible, but creating a cube texture is easier than
a full 360-degree spherical texture.
Think of what a cube made out of paper would look like unfolded, using Hedly and his
pals as the subject, as shown Figure 10-8.