glTexEnv
Prev | GL | Next

## 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`);`

## Python Specification

``glTexEnvf`` | `(` | ``target`, `pname`, `param`) → `None``
``glTexEnvi`` | `(` | ``target`, `pname`, `param`) → `None``

## 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`, or `GL_REPLACE`.

## C Specification

`void `glTexEnvfv`` | `(` | `GLenum `target`, GLenum `pname`, const GLfloat *`params`);`
`void `glTexEnviv`` | `(` | `GLenum `target`, GLenum `pname`, const GLint *`params`);`

## Python Specification

``glTexEnvfv`` | `(` | ``target`, `pname`, `params`) → `None``
``glTexEnviv`` | `(` | ``target`, `pname`, `params`) → `None``

## 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` and `GL_TEXTURE_ENV_COLOR`.
`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 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. 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 [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, `glTexImage2D`, `glTexImage3D`, `glCopyTexImage1D`, and `glCopyTexImage2D`). In a one-component image, L t indicates that single component. A two-component image uses L t and A t . A three-component image has only a color value, C t . A four-component image has both a color value C t and an alpha value A t .

Base internal | Texture functions
| `GL_MODULATE` | `GL_DECAL` | `GL_BLEND` | `GL_REPLACE`
`GL_ALPHA` | C v = C f | undefined | C v = C f | C v = C f
A v = A f A t | A v = A f | A v = A t
`GL_LUMINANCE` | C v = L t C f | undefined | C v = ( 1 - L t ) C f | C v = L t
|  |  | + L t C c |
1 | A v = A f | A v = A f | A v = A f
`GL_LUMINANCE` | C v = L t C f | undefined | C v = ( 1 - L t ) C f | C v = L t
_ALPHA |  |  | + L t C c |
2 | A v = A t A f | A v = A t A f | A v = A t
`GL_INTENSITY` | C v = C f I t | undefined | C v = ( 1 - I t ) C f | C v = I t
|  |  | + I t C c |
c | A v = A f I t | A v = ( 1 - I t ) A f | A v = I t
|  |  | + I t A c |
`GL_RGB` | C v = C t C f | C v = C t | C v = ( 1 - C t ) C f | C v = C t
|  |  | + C t C c |
3 | A v = A f | A v = A f | A v = A f | A v = A f
`GL_RGBA` | C v = C t C f | C v = ( 1 - A t ) C f | C v = ( 1 - C t ) C f | C v = C t
|  | + A t C t | + C t C c |
4 | A v = A t A f | A v = A f | A v = A t A f | A v = A t

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

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

## Notes

`GL_REPLACE` may only be used if the GL version is 1.1 or greater.

Internal formats other than 1, 2, 3, or 4 may only be used if the GL version is 1.1 or greater.

When the `GL_ARB_multitexture` extension is supported, `glTexEnv` controls the texture environment for the current active texture unit, selected by `glActiveTextureARB`.

## 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 `glTexEnv` is executed between the execution of `glBegin` and the corresponding execution of `glEnd`.

## Associated Gets

`glGetTexEnv`

## See Also

glActiveTextureARB, glCopyPixels, glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D, glCopyTexSubImage3D, glTexImage1D, glTexImage2D, glTexImage3D, glTexParameter, glTexSubImage1D, glTexSubImage2D, glTexSubImage3D

Prev | Up | Next
glTexCoordPointer | Home | glTexGen