void glTexEnvf( GLenum target, GLenum pname, GLfloat param) void glTexEnvi( GLenum target, GLenum pname, GLint param) void glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params) void glTexEnviv( GLenum target, GLenum pname, const GLint *params)
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. If pname is GL_TEXTURE_LIGHTING_MODE_HP, two possible values for param may be specified: either GL_TEXTURE_PRE_SPECULAR_HP or GL_TEXTURE_POST_SPECULAR_HP.
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 (see glTexImage1D, glTexImage2D, glCopyTexImage1D, and glCopyTexImage2D). 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 Ct and an alpha value At.
Base Internal Format |
Texture Functions | |||
---|---|---|---|---|
GL_MODULATE | GL_DECAL | GL_BLEND | GL_REPLACE | |
GL_ALPHA | Cv = Cf | (undefined ) | Cv = Cf | Cv = Cf |
Av = Af At | Av = Af | Av = At | ||
GL_LUMINANCE 1 |
Cv = Lt Cf | (undefined ) | Cv = (1 Lt ) Cf + Lt Cc | Cv = Lt |
Av = Af | Av = Af | Av = Af | ||
GL_LUMINANCE_ALPHA 2 |
Cv = Lt Cf | (undefined ) | Cv = (1 Lt ) Cf + Lt Cc | Cv = Lt |
Av = At Af | Av = At Af | Av = At | ||
GL_INTENSITY | Cv = Cf It | (undefined ) | Cv = (1 It ) Cf + It Cc | Cv = It |
Av = Af It | Av = (1 It ) Af + It Ac | Av = It | ||
GL_RGB 3 |
Cv = Ct Cf | Cv = Ct | Cv = (1 Ct ) Cf + Ct Cc | Cv = Ct |
Av = Af | Av = Af | Av = Af | Av = Af | |
GL_RGBA 4 |
Cv = Ct Cf | Cv = (1 At ) Cf + At Ct | Cv = (1 Ct ) Cf + Ct Cc | Cv = Ct |
Av = At Af | Av = Af | Av = At Af | 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
GL_TEXTURE_LIGHTING_MODE_HP may only be used if the GL_HP_texture_lighting extension is supported.
Internal formats other than 1, 2, 3, or 4 may only be used if the GL version is 1.1 or greater.