void glTexEnvf(GLenum target, GLenum pname, GLfloat param) void glTexEnvi(GLenum target, GLenum pname, GLint param)
target | Specifies a texture environment. Must be GL_TEXTURE_ENV. |
pname | Specifies the symbolic name of a single-valued texture environment parameter. Must be GL_TEXTURE_ENV_MODE. |
param | Specifies a single symbolic constant, one of GL_MODULATE, GL_DECAL, GL_BLEND, or GL_REPLACE. |
void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params) void glTexEnviv(GLenum target, GLenum pname, const GLint *params)
target | Specifies a texture environment. Must be GL_TEXTURE_ENV. |
pname | Specifies the symbolic name of a texture environment parameter. Accepted values are GL_TEXTURE_ENV_MODE and GL_TEXTURE_ENV_COLOR. |
params | Specifies a pointer to a parameter array that contains either a single symbolic constant or an RGBA color. |
If pname is GL_TEXTURE_ENV_MODE, then params is (or points to) the symbolic name of a texture function. Four texture functions may be specified: GL_MODULATE, GL_DECAL, GL_BLEND, and GL_REPLACE.
A texture function acts on the fragment to be textured using
the texture image value that applies to the fragment (see
glTexParameter) and produces an RGBA
color for that fragment. The following table shows how the RGBA color is
produced for each of the three texture functions that can be chosen.
C is a triple of color values (RGB) and A is the associated alpha value.
RGBA values extracted from a texture image are in the range
A texture image can have up to four components per texture element. In a one-component image, Lt indicates that single component. A two-component image uses Lt and At . A three-component image has only a color value, Ct. A four-component image has both a color value C and an alpha value At.
Base InternalFormat | GL_MODULATE | GL_DECAL | GL_BLEND | GL_REPLACE |
---|---|---|---|---|
GL_ALPHA | Cv = Cf Av = AtAf | undefined | Cv = Cf Av = AtAf | Cv = Cf Av = At |
GL_LUMINANCE (1) | Cv = LtCf Av = Af | undefined | Cv = (1 - Lt)Cf + LtCc Av = Af | Cv = Lt Av = Af |
GL_LUMINANCE_ALPHA (2) | Cv = LtCf Av = AtAf | undefined | Cv = (1 - Lt)Cf + LtCc Av = AtAf | Cv = Lt Av = At |
GL_INTENSITY | Cv = ItCf Av = ItAf | undefined | Cv = (1 - It)Cf + ItCc Av = ItAf | Cv = It Av = It |
GL_RGB (3) | Cv = CtCf Av = Af | Cv = Ct Av = Af | Cv = (1 - Ct)Cf + CtCc Av = Af | Cv = Ct Av = Af |
GL_RGBA (4) | Cv = CtCf Av = AtAf | Cv = (1 - At)Cf + AtCt Av = Af | Cv = (1 - Ct)Cf + CtCc Av = AtAf | Cv = Ct Av = At |
If pname is GL_TEXTURE_ENV_COLOR, params is a pointer to an
array that holds an RGBA color consisting of four values.
Integer color components are interpreted linearly such that
the most positive integer maps to 1.0, and the most negative
integer maps to -1.0. The values are clamped to the range
GL_TEXTURE_ENV_MODE defaults to GL_MODULATE and
GL_TEXTURE_ENV_COLOR defaults to
Internal formats other than 1, 2, 3, or 4 may only be used if the GL version is 1.1 or greater.
GL_INVALID_OPERATION is generated if glTexEnv is executed between the execution of glBegin and the corresponding execution of glEnd.