glTexEnvf, glTexEnvi, glTexEnvfv, glTexEnviv

These functions set texture environment parameters.

void glTexEnvf(
  GLenum target,
  GLenum pname,
  GLfloat param
);

void glTexEnvi(
  GLenum target,
  GLenum pname,
  GLint param
);

Parameters

target
A texture environment. Must be GL_TEXTURE_ENV.
pname
The symbolic name of a single valuedtexture environment parameter. Must be GL_TEXTURE_ENV_MODE.
param
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
);

Parameters

target
A texture environment. Must be GL_TEXTURE_ENV.
pname
The symbolic name of a texture environment parameter. Accepted values are GL_TEXTURE_ENV_MODE and GL_TEXTURE_ENV_COLOR.
params
A pointer to an array of parameters: either a single symbolic constant or an RGBA color.

Remarks

A texture environment specifies how texture values are interpreted when a fragment is textured. The target parameter must be GL_TEXTURE_ENV. The pname parameter can be either GL_TEXTURE_ENV_MODE or GL_TEXTURE_ENV_COLOR.

If pname is GL_TEXTURE_ENV_MODE, then params is (or points to) the symbolic name of a texture function. Three texture functions are defined: GL_MODULATE, GL_DECAL, and GL_BLEND.

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 [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, 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 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.

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. Cc takes these four values.

GL_TEXTURE_ENV_MODE defaults to GL_MODULATE and GL_TEXTURE_ENV_COLOR defaults to (0,0,0,0).

The following function retrieves information related to glTexEnv:

glGetTexEnv

Error Codes

The following are the error codes generated and their conditions.

Error code Condition
GL_INVALID_ENUM target or pname was not one of the accepted defined values, or when params should have had a defined constant value (based on the value of pname) and did not.
GL_INVALID_OPERATION glTexEnv was called between a call to glBegin and the corresponding call to glEnd.

Requirements

  Windows NT/2000: Requires Windows NT 3.5 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in Gl.h.
  Library: Use Opengl32.lib.

See Also

glBegin, glEnd, glTexImage1D, glTexImage2D, glTexParameter


  

Show: