fglTexEnv(3G) OpenGL Reference fglTexEnv(3G)NAME
fglTexEnvf, fglTexEnvi, fglTexEnvfv, fglTexEnviv - set texture
environment parameters
FORTRAN SPECIFICATION
SUBROUTINE fglTexEnvf( INTEGER*4 target,
INTEGER*4 pname,
REAL*4 param )
SUBROUTINE fglTexEnvi( INTEGER*4 target,
INTEGER*4 pname,
INTEGER*4 param )
PARAMETERS
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, GL_REPLACE, GL_REPLACE_EXT, or GL_ADD.
FORTRAN SPECIFICATION
SUBROUTINE fglTexEnvfv( INTEGER*4 target,
INTEGER*4 pname,
CHARACTER*8 params )
SUBROUTINE fglTexEnviv( INTEGER*4 target,
INTEGER*4 pname,
CHARACTER*8 params )
PARAMETERS
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, GL_TEXTURE_ENV_COLOR, and
GL_TEXTURE_ENV_BIAS_SGIX.
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 GL_TEXTURE_ENV. pname can be
GL_TEXTURE_ENV_MODE, GL_TEXTURE_ENV_COLOR, or GL_TEXTURE_ENV_BIAS_SGIX.
Page 1
fglTexEnv(3G) OpenGL Reference fglTexEnv(3G)
If pname is GL_TEXTURE_ENV_MODE, then params is (or points to) the
symbolic name of a texture function. Six texture functions may be
defined: GL_MODULATE, GL_DECAL, GL_BLEND, GL_REPLACE, GL_REPLACE_EXT,
and GL_ADD.
A texture function acts on the fragment to be textured using the texture
image value that applies to the fragment (see fglTexParameter) 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
fglTexImage1D and fglTexImage2D). In an image of GL_LUMINANCE format L
t
indicates the single component. In an image of GL_ALPHA format A
t
indicates the single component. In an image of GL_INTENSITY 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 .
t t
number of texture functions
components GL_MODULATE GL_DECAL GL_BLEND
______________________________________________________________________
GL_LUMINANCE 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
______________________________________________________________________
GL_ALPHA C =C C =C
v f v f
A =A A undefined A =A A
v t f v t f
______________________________________________________________________
GL_INTENSITY 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
______________________________________________________________________
GL_LUMINANCE_ALPHA 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
______________________________________________________________________
GL_RGB 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
______________________________________________________________________
GL_RGBA 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
fglTexEnv(3G) OpenGL Reference fglTexEnv(3G)
number of texture functions
components GL_REPLACE_EXT GL_ADD (SGIX) GL_ADD (EXT)
__________________________________________________________________
GL_LUMINANCE C =L C =C +L C +C C =C +L
v t v f t c b v f t
1 A =A A =A A =A
v f v f v f
__________________________________________________________________
GL_ALPHA C =C C =C C =C
v f v f v f
A =A A =A A A =A A
v t v t f v f t
__________________________________________________________________
GL_INTENSITY C =I C =C +I C +C C =C +I
v t v f t c b v f t
A =I A =A +I A +A A =A +I
v t v f t c b v f t
__________________________________________________________________
GL_LUMINANCE_ALPHA C =L C =C +L C +C C =C +L
v t v f t c b v f t
2 A =A A =A A A =A A
v t v t f v f t
__________________________________________________________________
GL_RGB C =C C =C +C C +C C =C +C
v t v f t c b v f t
3 A =A A =A A =A
v f v f v f
__________________________________________________________________
GL_RGBA C =C C =C +C C +C C =C +C
v t v f t c b v f t
4 A =A A =A A A =A A
v t v t f v f t
Page 3
fglTexEnv(3G) OpenGL Reference fglTexEnv(3G)
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 [0,1] when they are specified. C takes these four values.
c
If pname is GL_TEXTURE_ENV_BIAS_SGIX, 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.
GL_TEXTURE_ENV_MODE defaults to GL_MODULATE, GL_TEXTURE_ENV_COLOR
defaults to (0,0,0,0), and GL_TEXTURE_ENV_BIAS_SGIX defaults to
(0,0,0,0).
NOTES
GL_REPLACE may only be used if the GL version is 1.1 or greater.
GL_REPLACE_EXT is part of the EXT_texture extension. GL_ADD and is part
of both the SGIX_texture_add_env and EXT_texture_env_env extensions
although the texture function it enables differs between the two
extensions. GL_TEXTURE_ENV_BIAS_SGIX is part of the SGIX_texture_add_env
extension. See fglIntro for more information concerning extensions.
ERRORS
GL_INVALID_ENUM 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.
GL_INVALID_OPERATION is generated if fglTexEnv is executed between the
execution of fglBegin and the corresponding execution of fglEnd.
ASSOCIATED GETS
fglGetTexEnv
MACHINE DEPENDENCIES
RealityEngine, RealityEngine2, and VTX and High Impact and Maximum Impact
systems do not support GL_REPLACE_EXT.
With High Impact and Maximum Impact on Indigo2 systems, the GL_BLEND mode
is supported for GL_LUMINANCE and GL_LUMINANCE_ALPHA textures only. High
Impact and Maximum Impact on Octane systems supports all but GL_RGBA.
Specifying this mode for the unsupported texture formats will result in
texture-mapping being effectively disabled.
The SGIX_texture_add_env 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
Page 4
fglTexEnv(3G) OpenGL Reference fglTexEnv(3G)
Please note that this extension is not the same as the
EXT_texture_env_add extension despite the potentially confusing
similarity between names.
The EXT_texture_env_add extension is supported only on Octane2 VPro
systems. Please note that it is not the same as the SGIX_texture_add_env
extension despite the potentially confusing similarity between names.
SEE ALSO
fglCopyPixels, fglCopyTexImage1D, fglCopyTexImage2D,
fglCopyTexSubImage1D, fglCopyTexSubImage2D, fglCopyTexSubImage3D,
fglTexImage1D, fglTexImage2D, fglTexImage3D, fglTexParameter,
fglTexSubImage1D, fglTexSubImage2D, fglTexSubImage3D
Page 5