glTexEnv(3G) OpenGL Reference glTexEnv(3G)
NAME
glTexEnvf, glTexEnvi, glTexEnvfv, glTexEnviv - set texture environment
parameters
C SPECIFICATION
void glTexEnvf( GLenum target,
GLenum pname,
GLfloat param )
void glTexEnvi( GLenum target,
GLenum pname,
GLint param )
PARAMETERS
target Specifies a texture environment. Must be GLTEXTUREENV.
pname Specifies the symbolic name of a single-valued texture
environment parameter. Must be GLTEXTUREENVMODE.
param Specifies a single symbolic constant, one of GLMODULATE,
GLDECAL, GLBLEND, GLREPLACE, GLREPLACEEXT, or GLADD.
C SPECIFICATION
void glTexEnvfv( GLenum target,
GLenum pname,
const GLfloat *params )
void glTexEnviv( GLenum target,
GLenum pname,
const GLint *params )
PARAMETERS
target
Specifies a texture environment. Must be GLTEXTUREENV.
pname
Specifies the symbolic name of a texture environment parameter.
Accepted values are GLTEXTUREENVMODE, GLTEXTUREENVCOLOR, and
GLTEXTUREENVBIASSGIX.
params
Specifies a pointer to a parameter array that contains either a
single symbolic constant or an RGBA color.
DESCRIPTION
A texture environment specifies how texture values are interpreted when a
fragment is textured. target must be GLTEXTUREENV. pname can be
GLTEXTUREENVMODE, GLTEXTUREENVCOLOR, or GLTEXTUREENVBIASSGIX.
Page 1
glTexEnv(3G) OpenGL Reference glTexEnv(3G)
If pname is GLTEXTUREENVMODE, then params is (or points to) the
symbolic name of a texture function. Six texture functions may be
defined: GLMODULATE, GLDECAL, GLBLEND, GLREPLACE, GLREPLACEEXT,
and GLADD.
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 tables show how
the RGBA color is produced for each of the texture functions. 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 [0,1]. The
subscript f refers to the incoming fragment, the subscript t to the
texture image, the subscript c to the texture environment color, the
subscript b to the texture environment bias color, and subscript v
indicates a value produced by the texture function.
A texture image can have up to four components per texture element (see
glTexImage1D and glTexImage2D). In an image of GLLUMINANCE format L
t
indicates the single component. In an image of GLALPHA format A
t
indicates the single component. In an image of GLINTENSITY format I
t
indicates the single component. A two-component image uses L and A . A
t t
three-component image has only a color value, C . A four-component image
t
has both a color value C and an alpha value A . If a color triple is
t t
shown to be equal to a single component format, this denotes that each
component of the color triple is set equal to the single component.
Similarly when 2 color triples are shown as being multiplied, this
denotes that each component of the first triple is multiplied by the
corresponding component of the second triple.
number of texture functions
components GLMODULATE GLDECAL GLBLEND
______________________________________________________________________
GLLUMINANCE C =L C C =(1-L )C +L C
v t f v t f t c
1 A =A undefined A =A
v f v f
______________________________________________________________________
GLALPHA C =C C =C
v f v f
A =A A undefined A =A A
v t f v t f
______________________________________________________________________
GLINTENSITY C =I C C =(1-I )C +I C
v t f v t f t c
A =I A undefined A =(1-I )A +I A
v t f v t f t c
______________________________________________________________________
GLLUMINANCEALPHA C =L C C =(1-L )C +L C
v t f v t f t c
2 A =A A undefined A =A A
v t f v t f
______________________________________________________________________
GLRGB C =C C C =C C =(1-C )C +C C
v t f v t v t f t c
3 A =A A =A A =A
v f v f v f
______________________________________________________________________
GLRGBA C =C C C =(1-A )C +A C C =(1-C )C +C C
v t f v t f t t v t f t c
4 A =A A A =A A =A A
v t f v f v t f
Page 2
glTexEnv(3G) OpenGL Reference glTexEnv(3G)
number of texture functions
components GLREPLACEEXT GLADD
___________________________________________________
GLLUMINANCE C =L C =C +L C +C
v t v f t c b
1 A =A A =A
v f v f
___________________________________________________
GLALPHA C =C C =C
v f v f
A =A A =A A
v t v t f
___________________________________________________
GLINTENSITY C =I C =C +I C +C
v t v f t c b
A =I A =A +I A +A
v t v f t c b
___________________________________________________
GLLUMINANCEALPHA C =L C =C +L C +C
v t v f t c b
2 A =A A =A A
v t v t f
___________________________________________________
GLRGB C =C C =C +C C +C
v t v f t c b
3 A =A A =A
v f v f
___________________________________________________
GLRGBA C =C C =C +C C +C
v t v f t c b
4 A =A A =A A
v t v t f
If pname is GLTEXTUREENVCOLOR, 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 [0,1] when they are specified. C takes these four values.
c
If pname is GLTEXTUREENVBIASSGIX, 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 [0,1] when they are specified. C takes these four
b
values.
GLTEXTUREENVMODE defaults to GLMODULATE, GLTEXTUREENVCOLOR
defaults to (0,0,0,0), and GLTEXTUREENVBIASSGIX defaults to
(0,0,0,0).
NOTES
GLREPLACE may only be used if the GL version is 1.1 or greater.
GLREPLACEEXT is part of the EXTtexture extension. GLADD and
GLTEXTUREENVBIASSGIX are part of the SGIXtextureaddenv extension.
See glIntro for more information concerning extensions.
ERRORS
GLINVALIDENUM is generated when target or pname is not one of the
accepted defined values, or when params should have a defined constant
value (based on the value of pname) and does not.
GLINVALIDOPERATION is generated if glTexEnv is executed between the
execution of glBegin and the corresponding execution of glEnd.
Page 3
glTexEnv(3G) OpenGL Reference glTexEnv(3G)
ASSOCIATED GETS
glGetTexEnv
MACHINE DEPENDENCIES
RealityEngine, RealityEngine2, and VTX and High Impact and Maximum Impact
systems do not support GLREPLACEEXT.
With High Impact and Maximum Impact on Indigo2 systems, the GLBLEND mode
is supported for GLLUMINANCE and GLLUMINANCEALPHA textures only. High
Impact and Maximum Impact on Octane systems supports all but GLRGBA.
Specifying this mode for the unsupported texture formats will result in
texture-mapping being effectively disabled.
The SGIXtextureaddenv extension is supported only on InfiniteReality
systems. There is a significant restriction on the texture environment
bias color, however. Only two values are allowed for the bias: zero, or
exactly -0.5 times the texture environment color. (This makes the
expression C C +C equivalent to C C or (C -0.5)C , respectively.)
t c b t c t c
SEE ALSO
glCopyPixels, glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D,
glCopyTexSubImage2D, glTexImage1D, glTexImage2D, glTexParameter,
glTexSubImage1D, glTexSubImage2D
Page 4