next up previous contents
Next: 6.14 Color Coding and Up: 6 Texture Mapping Previous: 6.12 Texture Mosaicing   Contents

6.13 Texture Coordinate Generation

Texture coordinates for a fragment are computed by interpolating the texture coordinates for a set of vertices. OpenGL provides several mechanisms for specifying the texture coordinates at each vertex: texture coordinates may be supplied directly by the application using the glTexCoord() commands or vertex arrays, they may be generated automatically from parametric maps for evaluators, or they may be generated directly by OpenGL using a generation function.

OpenGL supports two mechanisms for computing a texture coordinate directly: distance from a plane, or the reflection vector using the vertex position and normal to compute this vector. The first form is useful for making texture coordinates which are proportional to the distance from the object to some other location and can be computed in either object coordinates or eye coordinates. The latter is useful for environment mapping with a sphere map. The texture coordinate generation function is specified separately for each texture coordinate.