Light | Dark

# docs.GL

OpenGL 3
OpenGL 2

# glGetTexEnv

## Name

glGetTexEnv — return texture environment parameters

## C Specification

`void glGetTexEnvfv(` | GLenum | target,
| GLenum | pname,
| GLfloat * | params`)`;

`void glGetTexEnviv(` | GLenum | target,
| GLenum | pname,
| GLint * | params`)`;

## Parameters

`target`

  Specifies a texture environment. May be `GL_TEXTURE_ENV`, `GL_TEXTURE_FILTER_CONTROL`, or `GL_POINT_SPRITE`.

`pname`

  Specifies the symbolic name of a texture environment parameter. Accepted values are `GL_TEXTURE_ENV_MODE`, `GL_TEXTURE_ENV_COLOR`, `GL_TEXTURE_LOD_BIAS`, `GL_COMBINE_RGB`, `GL_COMBINE_ALPHA`, `GL_SRC0_RGB`, `GL_SRC1_RGB`, `GL_SRC2_RGB`, `GL_SRC0_ALPHA`, `GL_SRC1_ALPHA`, `GL_SRC2_ALPHA`, `GL_OPERAND0_RGB`, `GL_OPERAND1_RGB`, `GL_OPERAND2_RGB`, `GL_OPERAND0_ALPHA`, `GL_OPERAND1_ALPHA`, `GL_OPERAND2_ALPHA`, `GL_RGB_SCALE`, `GL_ALPHA_SCALE`, or `GL_COORD_REPLACE`.

`params`

  Returns the requested data.

## Description

`glGetTexEnv` returns in `params` selected values of a texture environment that was specified with glTexEnv. `target` specifies a texture environment.

When `target` is `GL_TEXTURE_FILTER_CONTROL`, `pname` must be `GL_TEXTURE_LOD_BIAS`. When `target` is `GL_POINT_SPRITE`, `pname` must be `GL_COORD_REPLACE`. When `target` is `GL_TEXTURE_ENV`, `pname` can be `GL_TEXTURE_ENV_MODE`, `GL_TEXTURE_ENV_COLOR`, `GL_COMBINE_RGB`, `GL_COMBINE_ALPHA`, `GL_RGB_SCALE`, `GL_ALPHA_SCALE`, `GL_SRC0_RGB`, `GL_SRC1_RGB`, `GL_SRC2_RGB`, `GL_SRC0_ALPHA`, `GL_SRC1_ALPHA`, or `GL_SRC2_ALPHA`.

`pname` names a specific texture environment parameter, as follows:

`GL_TEXTURE_ENV_MODE`

  `params` returns the single-valued texture environment mode, a symbolic constant. The initial value is `GL_MODULATE`.

`GL_TEXTURE_ENV_COLOR`

  `params` returns four integer or floating-point values that are the texture environment color. Integer values, when requested, are linearly mapped from the internal floating-point representation such that 1.0 maps to the most positive representable integer, and -1.0 maps to the most negative representable integer. The initial value is (0, 0, 0, 0).

`GL_TEXTURE_LOD_BIAS`

  `params` returns a single floating-point value that is the texture level-of-detail bias. The initial value is 0.

`GL_COMBINE_RGB`

  `params` returns a single symbolic constant value representing the current RGB combine mode. The initial value is `GL_MODULATE`.

`GL_COMBINE_ALPHA`

  `params` returns a single symbolic constant value representing the current alpha combine mode. The initial value is `GL_MODULATE`.

`GL_SRC0_RGB`

  `params` returns a single symbolic constant value representing the texture combiner zero's RGB source. The initial value is `GL_TEXTURE`.

`GL_SRC1_RGB`

  `params` returns a single symbolic constant value representing the texture combiner one's RGB source. The initial value is `GL_PREVIOUS`.

`GL_SRC2_RGB`

  `params` returns a single symbolic constant value representing the texture combiner two's RGB source. The initial value is `GL_CONSTANT`.

`GL_SRC0_ALPHA`

  `params` returns a single symbolic constant value representing the texture combiner zero's alpha source. The initial value is `GL_TEXTURE`.

`GL_SRC1_ALPHA`

  `params` returns a single symbolic constant value representing the texture combiner one's alpha source. The initial value is `GL_PREVIOUS`.

`GL_SRC2_ALPHA`

  `params` returns a single symbolic constant value representing the texture combiner two's alpha source. The initial value is `GL_CONSTANT`.

`GL_OPERAND0_RGB`

  `params` returns a single symbolic constant value representing the texture combiner zero's RGB operand. The initial value is `GL_SRC_COLOR`.

`GL_OPERAND1_RGB`

  `params` returns a single symbolic constant value representing the texture combiner one's RGB operand. The initial value is `GL_SRC_COLOR`.

`GL_OPERAND2_RGB`

  `params` returns a single symbolic constant value representing the texture combiner two's RGB operand. The initial value is `GL_SRC_ALPHA`.

`GL_OPERAND0_ALPHA`

  `params` returns a single symbolic constant value representing the texture combiner zero's alpha operand. The initial value is `GL_SRC_ALPHA`.

`GL_OPERAND1_ALPHA`

  `params` returns a single symbolic constant value representing the texture combiner one's alpha operand. The initial value is `GL_SRC_ALPHA`.

`GL_OPERAND2_ALPHA`

  `params` returns a single symbolic constant value representing the texture combiner two's alpha operand. The initial value is `GL_SRC_ALPHA`.

`GL_RGB_SCALE`

  `params` returns a single floating-point value representing the current RGB texture combiner scaling factor. The initial value is 1.0.

`GL_ALPHA_SCALE`

  `params` returns a single floating-point value representing the current alpha texture combiner scaling factor. The initial value is 1.0.

`GL_COORD_REPLACE`

  `params` returns a single boolean value representing the current point sprite texture coordinate replacement enable state. The initial value is `GL_FALSE`.

## Notes

If an error is generated, no change is made to the contents of `params`.

For OpenGL versions 1.3 and greater, or when the `ARB_multitexture` extension is supported, `glGetTexEnv` returns the texture environment parameters for the active texture unit.

`GL_COMBINE_RGB`, `GL_COMBINE_ALPHA`, `GL_SRC0_RGB`, `GL_SRC1_RGB`, `GL_SRC2_RGB`, `GL_SRC0_ALPHA`, `GL_SRC1_ALPHA`, `GL_SRC2_ALPHA`, `GL_OPERAND0_RGB`, `GL_OPERAND1_RGB`, `GL_OPERAND2_RGB`, `GL_OPERAND0_ALPHA`, `GL_OPERAND1_ALPHA`, `GL_OPERAND2_ALPHA`, `GL_RGB_SCALE`, and `GL_ALPHA_SCALE` are available only if the GL version is 1.3 or greater.

`GL_TEXTURE_FILTER_CONTROL` and `GL_TEXTURE_LOD_BIAS` are available only if the GL version is 1.4 or greater.

`GL_POINT_SPRITE` and `GL_COORD_REPLACE` are available only if the GL version is 2.0 or greater.

## Errors

`GL_INVALID_ENUM` is generated if `target` or `pname` is not an accepted value.

`GL_INVALID_OPERATION` is generated if `glGetTexEnv` is executed between the execution of glBegin and the corresponding execution of glEnd.

## See Also

glActiveTexture, glTexEnv

## Copyright

Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see https://web.archive.org/web/20171022161616/http://oss.sgi.com/projects/FreeB/.

Think you can improve this page? Edit this page on GitHub.