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 or GL_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:
GL_TEXTURE_WIDTH
The params parameter returns a single value: 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: the height of the texture image. This value includes the border of the texture image.
GL_TEXTURE_COMPONENTS
The params parameter returns a single value: the number of components in the texture image.
GL_TEXTURE_BORDER
The params parameter returns a single value: the width in pixels of the border of 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 texture—either GL_TEXTURE_1D or GL_TEXTURE_2D—to 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.

QuickInfo

  Windows NT: Use version 3.5 and later.
  Windows: Use Windows 95 and later.
  Windows CE: Unsupported.
  Header: Declared in gl.h.
  Import Library: Link with opengl32.lib.

See Also

glBegin, glEnd, glGetTexParameter, glTexImage1D, glTexImage2D, glTexParameter