Light | Dark

# docs.GL

OpenGL 4
OpenGL 3
OpenGL 2
OpenGL ES 3

# glGetTexLevelParameter

## Name

glGetTexLevelParameter — return texture parameter values for a specific level of detail

## C Specification

`void glGetTexLevelParameterfv(` | GLenum target,
| GLint level,
| GLenum pname,
| GLfloat * params`)`;

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

## Parameters

`target`

  Specifies the symbolic name of the target texture, one of `GL_TEXTURE_2D`, `GL_TEXTURE_3D`, `GL_TEXTURE_2D_ARRAY`, `GL_TEXTURE_2D_MULTISAMPLE`, `GL_TEXTURE_CUBE_MAP_POSITIVE_X`, `GL_TEXTURE_CUBE_MAP_NEGATIVE_X`, `GL_TEXTURE_CUBE_MAP_POSITIVE_Y`, `GL_TEXTURE_CUBE_MAP_NEGATIVE_Y`, `GL_TEXTURE_CUBE_MAP_POSITIVE_Z`, `GL_TEXTURE_CUBE_MAP_NEGATIVE_Z`.

`level`

  Specifies the level-of-detail number of the desired image. Level 0 is the base image level. Level n is the nth mipmap reduction image.

`pname`

  Specifies the symbolic name of a texture parameter. `GL_TEXTURE_WIDTH`, `GL_TEXTURE_HEIGHT`, `GL_TEXTURE_DEPTH`, `GL_TEXTURE_INTERNAL_FORMAT`, `GL_TEXTURE_SAMPLES`, `GL_TEXTURE_FIXED_SAMPLE_LOCATIONS`, `GL_TEXTURE_RED_SIZE`, `GL_TEXTURE_GREEN_SIZE`, `GL_TEXTURE_BLUE_SIZE`, `GL_TEXTURE_ALPHA_SIZE`, `GL_TEXTURE_DEPTH_SIZE`, `GL_TEXTURE_STENCIL_SIZE`, `GL_TEXTURE_SHARED_SIZE`, `GL_TEXTURE_RED_TYPE`, `GL_TEXTURE_GREEN_TYPE`, `GL_TEXTURE_BLUE_TYPE`, `GL_TEXTURE_ALPHA_TYPE`, `GL_TEXTURE_DEPTH_TYPE`, and `GL_TEXTURE_COMPRESSED` are accepted.

`params`

  Returns the requested data.

## Description

`glGetTexLevelParameter` returns in `params` texture parameter values for a specific level-of-detail value, specified as `level`. `target` defines the target texture, either `GL_TEXTURE_2D`, `GL_TEXTURE_3D`, `GL_TEXTURE_2D_ARRAY`, `GL_TEXTURE_2D_MULTISAMPLE`, `GL_TEXTURE_CUBE_MAP_POSITIVE_X`, `GL_TEXTURE_CUBE_MAP_NEGATIVE_X`, `GL_TEXTURE_CUBE_MAP_POSITIVE_Y`, `GL_TEXTURE_CUBE_MAP_NEGATIVE_Y`, `GL_TEXTURE_CUBE_MAP_POSITIVE_Z`, or `GL_TEXTURE_CUBE_MAP_NEGATIVE_Z`.

`pname` specifies the texture parameter whose value or values will be returned.

The accepted parameter names are as follows:

`GL_TEXTURE_WIDTH`

  `params` returns a single value, the width of the texture image. The initial value is 0.

`GL_TEXTURE_HEIGHT`

  `params` returns a single value, the height of the texture image. The initial value is 0.

`GL_TEXTURE_DEPTH`

  `params` returns a single value, the depth of the texture image. The initial value is 0.

`GL_TEXTURE_INTERNAL_FORMAT`

  `params` returns a single value, the internal format of the texture image.

`GL_TEXTURE_SAMPLES`

  `params` returns a single value, the number of samples of the texture image.

`GL_FIXED_SAMPLE_LOCATIONS`

  `params` returns a single boolean value indicating if texture sample fixed locations are enabled.

`GL_TEXTURE_RED_TYPE`, `GL_TEXTURE_GREEN_TYPE`, `GL_TEXTURE_BLUE_TYPE`, `GL_TEXTURE_ALPHA_TYPE`, `GL_TEXTURE_DEPTH_TYPE`

  The data type used to store the component. The types `GL_NONE`, `GL_SIGNED_NORMALIZED`, `GL_UNSIGNED_NORMALIZED`, `GL_FLOAT`, `GL_INT`, and `GL_UNSIGNED_INT` may be returned to indicate missing, signed normalized fixed-point, unsigned normalized fixed-point, floating-point, signed unnormalized integer, and unsigned unnormalized integer components, respectively.

`GL_TEXTURE_RED_SIZE`, `GL_TEXTURE_GREEN_SIZE`, `GL_TEXTURE_BLUE_SIZE`, `GL_TEXTURE_ALPHA_SIZE`, `GL_TEXTURE_DEPTH_SIZE`, `GL_TEXTURE_SHARED_SIZE`

  The actual internal storage resolution of an individual component.

`GL_TEXTURE_COMPRESSED`

  `params` returns a single boolean value indicating if the texture image is stored in a compressed internal format.

## Notes

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

`glGetTexLevelParameter` returns the texture level parameters for the active texture unit.

## Errors

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

`GL_INVALID_VALUE` is generated if `level` is less than 0.

`GL_INVALID_VALUE` may be generated if `level` is greater than log 2 max, where max is the returned value of the relevant one of `GL_MAX_TEXTURE_SIZE`, `GL_MAX_3D_TEXTURE_SIZE` or `GL_MAX_CUBEMAP_TEXTURE_SIZE`.

`GL_INVALID_VALUE` is generated if `target` is `GL_TEXTURE_2D_MULTISAMPLE` and `level` is not zero.

## Tutorials

Sébastien Dominé - Using Texture Compression in OpenGL

## API Version Support

| OpenGL ES API Version
--- | ---
Function Name | 2.0 | 3.0 | 3.1
`glGetTexLevelParameterfv` | - | - | ✔
`glGetTexLevelParameteriv` | - | - | ✔

## See Also

glActiveTexture, glGetTexParameter, glCopyTexImage2D, glCopyTexSubImage2D, glCopyTexSubImage3D, glTexImage2D, glTexImage3D, glTexSubImage2D, glTexSubImage3D, glTexParameter glTexStorage2D, glTexStorage2DMultisample, glTexStorage3D,

## 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.