A SERVICE OF

logo

42
Chapter 3: Specifying the Appearance of Geometries
Applying Textures to Geometries
One way to affect the appearance of a geometry is to apply a texture to it. A texture is a
rectangular 2D image, for example, a 2D map of the world. This rectangular texture is
scaled or repeated to t on the surface of a 3D object, such as a sphere. The clamping and
repetition of a texture over a surface is programmatically controllable.
To create the image of an orange, for example, you rst create the orange, pitted texture
of orange rind and then apply it to a sphere. The difference between using and not using
a texture, in this example, is the difference between rendering a generic sphere and a
realistic-looking orange.
Figure 3-2 Applying a Texture to a Geometry
Texture Map Coordinates
A texture map is always dened by the coordinates s, for the horizontal component, and
t, for the vertical component, each of which range in values from 0.0 to 1.0, as shown in
Figure 3-3.