The command
void TexEnv[if] ( enum target, enum pname, T param ) ;
void TexEnv[if]v ( enum target, enum pname, T params ) ;
sets parameters of
the texture environment that specifies
how texture values are interpreted when texturing a fragment.
target must
currently be the symbolic constant TEXTURE_ENV.
pname is a symbolic constant indicating the parameter to be set.
In the first form of the command,
param is a value to which to set a single-valued parameter;
in the second form,
params is a pointer to an array of parameters:
either a single symbolic constant or a value or group of values to which
the parameter should be set.
The possible environment parameters are
TEXTURE_ENV_MODE and TEXTURE_ENV_COLOR.
TEXTURE_ENV_MODE may be set to one of
REPLACE, MODULATE, DECAL, or BLEND;
TEXTURE_ENV_COLOR is set to an RGBA color by providing four
single-precision
floating-point values in the range (values outside this range are
clamped to it).
If integers are provided for TEXTURE_ENV_COLOR,
then they are converted to floating-point as specified
in Table 2.6 for signed integers.
The value of TEXTURE_ENV_MODE specifies
a texture function.
The result of this function depends on the fragment and the texture array
value.
The precise form of the function depends on the base internal formats
of the texture arrays that were last specified.
In the following two tables,
,
,
, and
are the color components of the
incoming fragment;
,
,
,
,
, and
are the filtered texture values;
,
,
, and
are the texture environment color values;
and
,
,
, and
are the color components computed
by the texture function.
All of these color values are in the range
.
The REPLACE and MODULATE texture functions are specified in
Table 3.10,
and the DECAL and BLEND texture functions are specified in
Table 3.11.
Table 3.10: Replace and modulate texture functions.
Table 3.11: Decal and blend texture functions.
The state required for the current texture environment consists of the
four-valued integer indicating the texture function
and four floating-point TEXTURE_ENV_COLOR values.
In the initial state,
the texture function is given by MODULATE and
TEXTURE_ENV_COLOR is .