glGetTexLevelParameterfv, glGetTexLevelParameteriv

The glGetTexLevelParameterfv and glGetTexLevelParameteriv functions return texture parameter values for a specific level of detail.

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

Parameters

  • target
    The symbolic name of the target texture: either GL_TEXTURE_1D, GL_TEXTURE_2D, GL_PROXY_TEXTURE_1D, or GL_PROXY_TEXTURE_2D.

  • level
    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
    The symbolic name of a texture parameter. The following parameter names are accepted:

    Value Meaning
    GL_TEXTURE_WIDTH The params parameter returns a single value containing the width of the texture image. This value includes the border of the texture image.
    GL_TEXTURE_HEIGHT The params parameter returns a single value containing the height of the texture image. This value includes the border of the texture image.
    GL_TEXTURE_INTERNAL_FORMAT The params parameter returns a single value which describes the texel format of the texture.
    GL_TEXTURE_BORDER The params parameter returns a single value: the width in pixels of the border of the texture image.
    GL_TEXTURE_RED_SIZE, The internal storage resolution of the red component of a texel. The resolution chosen by the OpenGL will be a close match for the resolution requested by the user with the component argument of glTexImage1D or glTexImage2D.
    GL_TEXTURE_GREEN_SIZE, The internal storage resolution of the green component of a texel. The resolution chosen by the OpenGL will be a close match for the resolution requested by the user with the component argument of glTexImage1D or glTexImage2D.
    GL_TEXTURE_BLUE_SIZE, The internal storage resolution of the blue component of a texel. The resolution chosen by the OpenGL will be a close match for the resolution requested by the user with the component argument of glTexImage1D or glTexImage2D.
    GL_TEXTURE_ALPHA_SIZE, The internal storage resolution of the alpha component of a texel. The resolution chosen by the OpenGL will be a close match for the resolution requested by the user with the component argument of glTexImage1D or glTexImage2D.
    GL_TEXTURE_LUMINANCE_SIZE, The internal storage resolution of the luminance component of a texel. The resolution chosen by the OpenGL will be a close match for the resolution requested by the user with the component argument of glTexImage1D or glTexImage2D.
    GL_TEXTURE_INTENSITY_SIZE The internal storage resolution of the intensity component of a texel. The resolution chosen by the OpenGL will be a close match for the resolution requested by the user with the component argument of glTexImage1D or glTexImage2D.
    GL_TEXTURE_COMPONENTS The params parameter returns a single value: the number of components in the texture image.
  • params
    Returns the requested data.

Remarks

The glGetTexLevelParameter function returns in params texture parameter values for a specific level-of-detail value, specified as level. The target parameter defines the target textureeither GL_TEXTURE_1D, GL_TEXTURE_2D, GL_PROXY_TEXTURE_1D, or GL_PROXY_TEXTURE_2Dto specify one- or two-dimensional texturing. The pname parameter specifies the texture parameter whose value or values will be returned.

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

Error Codes

The following are the error codes generated and their conditions.

Error code Condition
GL_INVALID_ENUM target or pname was not an accepted value.
GL_INVALID_VALUE level is less than zero or greater than log (2) max, where max is the returned value of GL_MAX_TEXTURE_SIZE.
GL_INVALID_OPERATION glGetTexLevelParameter 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, glGetTexParameter, glTexImage1D, glTexImage2D, glTexParameter