420 10. The Rendering Engine
the following ways. These are known as texture addressing modes; which mode
is used is under the control of the user.
z Wrap. In this mode, the texture is repeated over and over in every direc-
tion. All texture coordinates of the form (ju, kv) are equivalent to the
coordinate (u, v), where j and k are arbitrary integers.
z Mirror. This mode acts like wrap mode, except that the texture is mir-
rored about the v-axis for odd integer multiples of u, and about the u-
axis for odd integer multiples of v.
z Clamp. In this mode, the colors of the texels around the outer edge of the
texture are simply extended when texture coordinates fall outside the
normal range.
z Border color. In this mode, an arbitrary user-specifi ed color is used for the
region outside the [0, 1] texture coordinate range.
These texture addressing modes are depicted in Figure 10.16.
Figure 10.16. Texture addressing modes.
Texture Formats
Texture bitmaps can be stored on disk in virtually any image format provided
your game engine includes the code necessary to read it into memory. Com-
mon formats include Targa (.tga), Portable Network Graphics (.png), Win-
dows Bitmap (.bmp), and Tagged Image File Format (.tif). In memory, textures
are usually represented as two-dimensional (strided) arrays of pixels using