OpenGL C bindings library: libGL.a
void glGetTexImage(GLenum Target, GLint Level, GLenum Format, GLenum Type, GLvoid *Pixels)
The glGetTexImage subroutine returns a texture image and places it in the Pixels parameter. Target specifies whether the desired texture image is one specified by glTexImage1D (GL_TEXTURE_1D), TexImage2D (GL_TEXTURE_2D), or by TexImage3DEXT (GL_TEXTURE_3D_EXT). Level specifies the level-of-detail number of the desired image. Format and Type specify the format and type of the desired image array. (See the glTexImage1D and glDrawPixels subroutines for a description of the acceptable values for the Format and Type parameters, respectively.)
Operation of glGetTexImage is best understood by considering the selected internal four-component texture image to be a red, green, blue, alpha (RGBA) color buffer that is the size of the image. The semantics of glGetTexImage are then identical to those of glReadPixels called with the same Format and Type, with x and y set to 0 (zero), Width set to the width of the texture image (including the border if one was specified), and Height set to 1 (one) for one-dimensional (1D) images, or to the height of the texture image (including the border if one was specified) for two-dimensional (2D) images. Because the internal texture image is an RGBA image, pixel formats GL_COLOR_INDEX, GL_STENCIL_INDEX, and GL_DEPTH_COMPONENT are not accepted, and pixel type GL_BITMAP is not accepted.
If the selected texture image does not contain four components, the following mappings are applied:
To determine the required size of Pixels, use the glGetTexLevelParameter subroutine to ascertain the dimensions of the internal texture image, then scale the required number of pixels by the storage required for each pixel, based on Format and Type. Be sure to consider the pixel storage parameters, especially GL_PACK_ALIGNMENT.
If an error is generated, no change is made to the contents of Pixels.
Format of GL_ABGR_EXT is part of the _extname (EXT_abgr) extension, not part of the core GL command set.
Target of GL_TEXTURE_3D_EXT is part of the _extname (EXT_texture3D) extension, not part of the core GL command set.
Associated gets for the glGetTexImage subroutine are as follows. (See the glGet subroutine for more information.)
glGetTexLevelParameter with argument GL_TEXTURE_WIDTH
glGetTexLevelParameter with argument GL_TEXTURE_HEIGHT
glGetTexLevelParameter with argument GL_TEXTURE_BORDER
glGetTexLevelParameter with argument GL_TEXTURE_COMPONENTS
glGet with arguments GL_PACK_ALIGNMENT and others.
/usr/include/GL/gl.h | Contains C language constants, variable type definitions, and ANSI function prototypes for OpenGL. |
The glBegin or glEnd subroutine, glDrawPixels subroutine, glReadPixels subroutine, glTexImage1D subroutine, glTexImage2D subroutine.