![]() |
|Download Files|
![]() ![]() ![]() ![]() ![]() Next: 2.11 Clipping Up: 2.10 Coordinate Transformations Previous: 2.10.3 Normal Transformation
2.10.4 Generating texture coordinates
void TexGen[ifd] ( enum coord, enum pname, T param ) ; controls texture coordinate generation. coord must be one of the constants S, T, R, or Q, indicating that the pertinent coordinate is the s, t, r, or q coordinate, respectively. In the first form of the command, param is a symbolic constant specifying a single-valued texture generation parameter; in the second form, params is a pointer to an array of values that specify texture generation parameters. pname must be one of the three symbolic constants TEXTURE_GEN_MODE, OBJECT_PLANE, or EYE_PLANE. If pname is TEXTURE_GEN_MODE, then either params points to or param is an integer that is one of the symbolic constants OBJECT_LINEAR, EYE_LINEAR, or SPHERE_MAP. If TEXTURE_GEN_MODE indicates OBJECT_LINEAR, then the generation function for the coordinate indicated by coord is
If TEXTURE_GEN_MODE indicates EYE_LINEAR, then the function is where
When used with a suitably constructed texture image,
calling TexGen with TEXTURE_GEN_MODE indicating SPHERE_MAP
can simulate the reflected image of a spherical environment on a polygon.
SPHERE_MAP
texture coordinates are generated as follows.
Denote the unit vector pointing from the origin to the vertex
(in eye coordinates) by
and let A texture coordinate generation function is enabled or disabled using Enable and Disable with an argument of TEXTURE_GEN_S, TEXTURE_GEN_T, TEXTURE_GEN_R, or TEXTURE_GEN_Q (each indicates the corresponding texture coordinate). When enabled, the specified texture coordinate is computed according to the current EYE_LINEAR, OBJECT_LINEAR or SPHERE_MAP specification, depending on the current setting of TEXTURE_GEN_MODE for that coordinate. When disabled, subsequent vertices will take the indicated texture coordinate from the current texture coordinates.
The state required for texture coordinate generation
comprises a three-valued integer
for each coordinate indicating coordinate generation mode,
and a bit for each coordinate to indicate whether texture coordinate
generation is enabled or disabled.
In addition,
four coefficients are required
for the four coordinates for
each of EYE_LINEAR and OBJECT_LINEAR.
The initial state has the texture generation function disabled for
all texture coordinates.
The initial values of
![]() ![]() ![]() ![]() ![]() Next: 2.11 Clipping Up: 2.10 Coordinate Transformations Previous: 2.10.3 Normal Transformation David Blythe Sat Mar 29 02:23:21 PST 1997
|