Light | Dark

# docs.GL

OpenGL 4
OpenGL 3
OpenGL 2
OpenGL ES 3
OpenGL ES 2

# glGetTexParameter

## Name

glGetTexParameter — return texture parameter values

## C Specification

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

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

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

`void glGetTexParameterIuiv(` | GLenum target,
| GLenum pname,
| GLuint * params`)`;

`void glGetTextureParameterfv(` | GLuint texture,
| GLenum pname,
| GLfloat *params`)`;

`void glGetTextureParameteriv(` | GLuint texture,
| GLenum pname,
| GLint *params`)`;

`void glGetTextureParameterIiv(` | GLuint texture,
| GLenum pname,
| GLint *params`)`;

`void glGetTextureParameterIuiv(` | GLuint texture,
| GLenum pname,
| GLuint *params`)`;

## Parameters

`target`

  Specifies the target to which the texture is bound for `glGetTexParameterfv`, `glGetTexParameteriv`, `glGetTexParameterIiv`, and `glGetTexParameterIuiv` functions. `GL_TEXTURE_1D`, `GL_TEXTURE_1D_ARRAY`, `GL_TEXTURE_2D`, `GL_TEXTURE_2D_ARRAY`, `GL_TEXTURE_2D_MULTISAMPLE`, `GL_TEXTURE_2D_MULTISAMPLE_ARRAY`, `GL_TEXTURE_3D`, `GL_TEXTURE_CUBE_MAP`, `GL_TEXTURE_RECTANGLE`, and `GL_TEXTURE_CUBE_MAP_ARRAY` are accepted.

`texture`

  Specifies the texture object name for `glGetTextureParameterfv`, `glGetTextureParameteriv`, `glGetTextureParameterIiv`, and `glGetTextureParameterIuiv` functions.

`pname`

  Specifies the symbolic name of a texture parameter. `GL_DEPTH_STENCIL_TEXTURE_MODE`, `GL_IMAGE_FORMAT_COMPATIBILITY_TYPE`, `GL_TEXTURE_BASE_LEVEL`, `GL_TEXTURE_BORDER_COLOR`, `GL_TEXTURE_COMPARE_MODE`, `GL_TEXTURE_COMPARE_FUNC`, `GL_TEXTURE_IMMUTABLE_FORMAT`, `GL_TEXTURE_IMMUTABLE_LEVELS`, `GL_TEXTURE_LOD_BIAS`, `GL_TEXTURE_MAG_FILTER`, `GL_TEXTURE_MAX_LEVEL`, `GL_TEXTURE_MAX_LOD`, `GL_TEXTURE_MIN_FILTER`, `GL_TEXTURE_MIN_LOD`, `GL_TEXTURE_SWIZZLE_R`, `GL_TEXTURE_SWIZZLE_G`, `GL_TEXTURE_SWIZZLE_B`, `GL_TEXTURE_SWIZZLE_A`, `GL_TEXTURE_SWIZZLE_RGBA`, `GL_TEXTURE_TARGET`, `GL_TEXTURE_VIEW_MIN_LAYER`, `GL_TEXTURE_VIEW_MIN_LEVEL`, `GL_TEXTURE_VIEW_NUM_LAYERS`, `GL_TEXTURE_VIEW_NUM_LEVELS`, `GL_TEXTURE_WRAP_S`, `GL_TEXTURE_WRAP_T`, and `GL_TEXTURE_WRAP_R` are accepted.

`params`

  Returns the texture parameters.

## Description

`glGetTexParameter` and `glGetTextureParameter` return in `params` the value or values of the texture parameter specified as `pname`. `target` defines the target texture. `GL_TEXTURE_1D`, `GL_TEXTURE_2D`, `GL_TEXTURE_3D`, `GL_TEXTURE_1D_ARRAY`, `GL_TEXTURE_2D_ARRAY`, `GL_TEXTURE_RECTANGLE`, `GL_TEXTURE_CUBE_MAP`, `GL_TEXTURE_CUBE_MAP_ARRAY`, `GL_TEXTURE_2D_MULTISAMPLE`, or `GL_TEXTURE_2D_MULTISAMPLE_ARRAY` specify one-, two-, or three-dimensional, one-dimensional array, two-dimensional array, rectangle, cube-mapped or cube-mapped array, two-dimensional multisample, or two-dimensional multisample array texturing, respectively. `pname` accepts the same symbols as glTexParameter, with the same interpretations:

`GL_DEPTH_STENCIL_TEXTURE_MODE`

  Returns the single-value depth stencil texture mode, a symbolic constant. The initial value is `GL_DEPTH_COMPONENT`.

`GL_TEXTURE_MAG_FILTER`

  Returns the single-valued texture magnification filter, a symbolic constant. The initial value is `GL_LINEAR`.

`GL_TEXTURE_MIN_FILTER`

  Returns the single-valued texture minification filter, a symbolic constant. The initial value is `GL_NEAREST_MIPMAP_LINEAR`.

`GL_TEXTURE_MIN_LOD`

  Returns the single-valued texture minimum level-of-detail value. The initial value is -1000 .

`GL_TEXTURE_MAX_LOD`

  Returns the single-valued texture maximum level-of-detail value. The initial value is 1000.

`GL_TEXTURE_BASE_LEVEL`

  Returns the single-valued base texture mipmap level. The initial value is 0.

`GL_TEXTURE_MAX_LEVEL`

  Returns the single-valued maximum texture mipmap array level. The initial value is 1000.

`GL_TEXTURE_SWIZZLE_R`

  Returns the red component swizzle. The initial value is `GL_RED`.

`GL_TEXTURE_SWIZZLE_G`

  Returns the green component swizzle. The initial value is `GL_GREEN`.

`GL_TEXTURE_SWIZZLE_B`

  Returns the blue component swizzle. The initial value is `GL_BLUE`.

`GL_TEXTURE_SWIZZLE_A`

  Returns the alpha component swizzle. The initial value is `GL_ALPHA`.

`GL_TEXTURE_SWIZZLE_RGBA`

  Returns the component swizzle for all channels in a single query.

`GL_TEXTURE_WRAP_S`

  Returns the single-valued wrapping function for texture coordinate s, a symbolic constant. The initial value is `GL_REPEAT`.

`GL_TEXTURE_WRAP_T`

  Returns the single-valued wrapping function for texture coordinate t, a symbolic constant. The initial value is `GL_REPEAT`.

`GL_TEXTURE_WRAP_R`

  Returns the single-valued wrapping function for texture coordinate r, a symbolic constant. The initial value is `GL_REPEAT`.

`GL_TEXTURE_BORDER_COLOR`

  Returns four integer or floating-point numbers that comprise the RGBA color of the texture border. Floating-point values are returned in the range 0 1 . Integer values are returned as a linear mapping of 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_COMPARE_MODE`

  Returns a single-valued texture comparison mode, a symbolic constant. The initial value is `GL_NONE`. See glTexParameter.

`GL_TEXTURE_COMPARE_FUNC`

  Returns a single-valued texture comparison function, a symbolic constant. The initial value is `GL_LEQUAL`. See glTexParameter.

`GL_TEXTURE_VIEW_MIN_LEVEL`

  Returns a single-valued base level of a texture view relative to its parent. The initial value is 0. See glTextureView.

`GL_TEXTURE_VIEW_NUM_LEVELS`

  Returns a single-valued number of levels of detail of a texture view. See glTextureView.

`GL_TEXTURE_VIEW_MIN_LAYER`

  Returns a single-valued first level of a texture array view relative to its parent. See glTextureView.

`GL_TEXTURE_VIEW_NUM_LAYERS`

  Returns a single-valued number of layers in a texture array view. See glTextureView.

`GL_TEXTURE_IMMUTABLE_LEVELS`

  Returns a single-valued number of immutable texture levels in a texture view. See glTextureView.

In addition to the parameters that may be set with glTexParameter, `glGetTexParameter` and `glGetTextureParameter` accept the following read-only parameters:

`GL_IMAGE_FORMAT_COMPATIBILITY_TYPE`

  Returns the matching criteria use for the texture when used as an image texture. Can return `GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE`, `GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS` or `GL_NONE`.

`GL_TEXTURE_IMMUTABLE_FORMAT`

  Returns non-zero if the texture has an immutable format. Textures become immutable if their storage is specified with glTexStorage1D, glTexStorage2D or glTexStorage3D. The initial value is `GL_FALSE`.

`GL_TEXTURE_TARGET`

  Returns the effective target of the texture object. For `glGetTex*Parameter` functions, this is the target parameter. For `glGetTextureParameter*`, it is the target to which the texture was initially bound when it was created, or the value of the target parameter to the call to `glCreateTextures` which created the texture.

## Notes

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

`GL_IMAGE_FORMAT_COMPATIBILITY_TYPE` is available only if the GL version is 4.2 or greater.

`GL_DEPTH_STENCIL_TEXTURE_MODE`, `GL_TEXTURE_VIEW_MIN_LEVEL`, `GL_TEXTURE_VIEW_NUM_LEVELS`, `GL_TEXTURE_VIEW_MIN_LAYER`, `GL_TEXTURE_VIEW_NUM_LAYERS` and `GL_TEXTURE_IMMUTABLE_LEVELS` are available only if the GL version is 4.3 or greater.

`GL_TEXTURE_TARGET` are available only if the GL version is 4.5 or greater.

## Errors

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

`GL_INVALID_ENUM` error is generated by `glGetTexParameter` if the effective `target` is not one of the accepted texture targets.

`GL_INVALID_OPERATION` is generated by `glGetTextureParameter*` if `texture` is not the name of an existing texture object.

## Version Support

| OpenGL Version
--- | ---
Function / Feature Name | 2.0 | 2.1 | 3.0 | 3.1 | 3.2 | 3.3 | 4.0 | 4.1 | 4.2 | 4.3 | 4.4 | 4.5
`glGetTexParameterIiv` | - | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔
`glGetTexParameterIuiv` | - | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔
`glGetTexParameterfv` | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔
`glGetTexParameteriv` | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔
`glGetTextureParameterIiv` | - | - | - | - | - | - | - | - | - | - | - | ✔
`glGetTextureParameterIuiv` | - | - | - | - | - | - | - | - | - | - | - | ✔
`glGetTextureParameterfv` | - | - | - | - | - | - | - | - | - | - | - | ✔
`glGetTextureParameteriv` | - | - | - | - | - | - | - | - | - | - | - | ✔

## See Also

glTexParameter, glTextureParameter, glTexStorage1D, glTexStorage2D, glTexStorage3D, glTextureStorage1D, glTextureStorage2D, glTextureStorage3D, glTextureView

## Copyright

Copyright © 1991-2006 Silicon Graphics, Inc. Copyright © 2010-2014 Khronos Group. 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.