'\" t .\" Title: glGetTexImage .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.76.1 .\" Date: 05/30/2012 .\" Manual: [FIXME: manual] .\" Source: [FIXME: source] .\" Language: English .\" .TH "GLGETTEXIMAGE" "3G" "05/30/2012" "[FIXME: source]" "[FIXME: manual]" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" glGetTexImage \- return a texture image .SH "C SPECIFICATION" .HP \w'void\ glGetTexImage('u .BI "void glGetTexImage(GLenum\ " "target" ", GLint\ " "level" ", GLenum\ " "format" ", GLenum\ " "type" ", GLvoid\ *\ " "img" ");" .SH "PARAMETERS" .PP \fItarget\fR .RS 4 Specifies which texture is to be obtained\&. \fBGL_TEXTURE_1D\fR, \fBGL_TEXTURE_2D\fR, \fBGL_TEXTURE_3D\fR, \fBGL_TEXTURE_1D_ARRAY\fR, \fBGL_TEXTURE_2D_ARRAY\fR, \fBGL_TEXTURE_RECTANGLE\fR, \fBGL_TEXTURE_CUBE_MAP_POSITIVE_X\fR, \fBGL_TEXTURE_CUBE_MAP_NEGATIVE_X\fR, \fBGL_TEXTURE_CUBE_MAP_POSITIVE_Y\fR, \fBGL_TEXTURE_CUBE_MAP_NEGATIVE_Y\fR, \fBGL_TEXTURE_CUBE_MAP_POSITIVE_Z\fR, and \fBGL_TEXTURE_CUBE_MAP_NEGATIVE_Z\fR are accepted\&. .RE .PP \fIlevel\fR .RS 4 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\&. .RE .PP \fIformat\fR .RS 4 Specifies a pixel format for the returned data\&. The supported formats are \fBGL_STENCIL_INDEX\fR, \fBGL_DEPTH_COMPONENT\fR, \fBGL_DEPTH_STENCIL\fR, \fBGL_RED\fR, \fBGL_GREEN\fR, \fBGL_BLUE\fR, \fBGL_RG\fR, \fBGL_RGB\fR, \fBGL_RGBA\fR, \fBGL_BGR\fR, \fBGL_BGRA\fR, \fBGL_RED_INTEGER\fR, \fBGL_GREEN_INTEGER\fR, \fBGL_BLUE_INTEGER\fR, \fBGL_RG_INTEGER\fR, \fBGL_RGB_INTEGER\fR, \fBGL_RGBA_INTEGER\fR, \fBGL_BGR_INTEGER\fR, \fBGL_BGRA_INTEGER\fR\&. .RE .PP \fItype\fR .RS 4 Specifies a pixel type for the returned data\&. The supported types are \fBGL_UNSIGNED_BYTE\fR, \fBGL_BYTE\fR, \fBGL_UNSIGNED_SHORT\fR, \fBGL_SHORT\fR, \fBGL_UNSIGNED_INT\fR, \fBGL_INT\fR, \fBGL_HALF_FLOAT\fR, \fBGL_FLOAT\fR, \fBGL_UNSIGNED_BYTE_3_3_2\fR, \fBGL_UNSIGNED_BYTE_2_3_3_REV\fR, \fBGL_UNSIGNED_SHORT_5_6_5\fR, \fBGL_UNSIGNED_SHORT_5_6_5_REV\fR, \fBGL_UNSIGNED_SHORT_4_4_4_4\fR, \fBGL_UNSIGNED_SHORT_4_4_4_4_REV\fR, \fBGL_UNSIGNED_SHORT_5_5_5_1\fR, \fBGL_UNSIGNED_SHORT_1_5_5_5_REV\fR, \fBGL_UNSIGNED_INT_8_8_8_8\fR, \fBGL_UNSIGNED_INT_8_8_8_8_REV\fR, \fBGL_UNSIGNED_INT_10_10_10_2\fR, \fBGL_UNSIGNED_INT_2_10_10_10_REV\fR, \fBGL_UNSIGNED_INT_24_8\fR, \fBGL_UNSIGNED_INT_10F_11F_11F_REV\fR, \fBGL_UNSIGNED_INT_5_9_9_9_REV\fR, and \fBGL_FLOAT_32_UNSIGNED_INT_24_8_REV\fR\&. .RE .PP \fIimg\fR .RS 4 Returns the texture image\&. Should be a pointer to an array of the type specified by \fItype\fR\&. .RE .SH "DESCRIPTION" .PP \fBglGetTexImage\fR returns a texture image into \fIimg\fR\&. \fItarget\fR specifies whether the desired texture image is one specified by \fBglTexImage1D\fR() (\fBGL_TEXTURE_1D\fR), \fBglTexImage2D\fR() (\fBGL_TEXTURE_1D_ARRAY\fR, \fBGL_TEXTURE_RECTANGLE\fR, \fBGL_TEXTURE_2D\fR or any of \fBGL_TEXTURE_CUBE_MAP_*\fR), or \fBglTexImage3D\fR() (\fBGL_TEXTURE_2D_ARRAY\fR, \fBGL_TEXTURE_3D\fR)\&. \fIlevel\fR specifies the level\-of\-detail number of the desired image\&. \fIformat\fR and \fItype\fR specify the format and type of the desired image array\&. See the reference page for \fBglTexImage1D\fR() for a description of the acceptable values for the \fIformat\fR and \fItype\fR parameters, respectively\&. .PP If a non\-zero named buffer object is bound to the \fBGL_PIXEL_PACK_BUFFER\fR target (see \fBglBindBuffer\fR()) while a texture image is requested, \fIimg\fR is treated as a byte offset into the buffer object\*(Aqs data store\&. .PP To understand the operation of \fBglGetTexImage\fR, consider the selected internal four\-component texture image to be an RGBA color buffer the size of the image\&. The semantics of \fBglGetTexImage\fR are then identical to those of \fBglReadPixels\fR(), with the exception that no pixel transfer operations are performed, when called with the same \fIformat\fR and \fItype\fR, with \fIx\fR and \fIy\fR set to 0, \fIwidth\fR set to the width of the texture image and \fIheight\fR set to 1 for 1D images, or to the height of the texture image for 2D images\&. .PP If the selected texture image does not contain four components, the following mappings are applied\&. Single\-component textures are treated as RGBA buffers with red set to the single\-component value, green set to 0, blue set to 0, and alpha set to 1\&. Two\-component textures are treated as RGBA buffers with red set to the value of component zero, alpha set to the value of component one, and green and blue set to 0\&. Finally, three\-component textures are treated as RGBA buffers with red set to component zero, green set to component one, blue set to component two, and alpha set to 1\&. .PP To determine the required size of \fIimg\fR, use \fBglGetTexLevelParameter\fR() to determine the dimensions of the internal texture image, then scale the required number of pixels by the storage required for each pixel, based on \fIformat\fR and \fItype\fR\&. Be sure to take the pixel storage parameters into account, especially \fBGL_PACK_ALIGNMENT\fR\&. .SH "NOTES" .PP If an error is generated, no change is made to the contents of \fIimg\fR\&. .PP \fBglGetTexImage\fR returns the texture image for the active texture unit\&. .SH "ERRORS" .PP \fBGL_INVALID_ENUM\fR is generated if \fItarget\fR, \fIformat\fR, or \fItype\fR is not an accepted value\&. .PP \fBGL_INVALID_VALUE\fR is generated if \fIlevel\fR is less than 0\&. .PP \fBGL_INVALID_VALUE\fR may be generated if \fIlevel\fR is greater than log 2 ⁡ max, where max is the returned value of \fBGL_MAX_TEXTURE_SIZE\fR\&. .PP \fBGL_INVALID_OPERATION\fR is returned if \fItype\fR is one of \fBGL_UNSIGNED_BYTE_3_3_2\fR, \fBGL_UNSIGNED_BYTE_2_3_3_REV\fR, \fBGL_UNSIGNED_SHORT_5_6_5\fR, \fBGL_UNSIGNED_SHORT_5_6_5_REV\fR, or \fBGL_UNSIGNED_INT_10F_11F_11F_REV\fR and \fIformat\fR is not \fBGL_RGB\fR\&. .PP \fBGL_INVALID_OPERATION\fR is returned if \fItype\fR is one of \fBGL_UNSIGNED_SHORT_4_4_4_4\fR, \fBGL_UNSIGNED_SHORT_4_4_4_4_REV\fR, \fBGL_UNSIGNED_SHORT_5_5_5_1\fR, \fBGL_UNSIGNED_SHORT_1_5_5_5_REV\fR, \fBGL_UNSIGNED_INT_8_8_8_8\fR, \fBGL_UNSIGNED_INT_8_8_8_8_REV\fR, \fBGL_UNSIGNED_INT_10_10_10_2\fR, \fBGL_UNSIGNED_INT_2_10_10_10_REV\fR, or \fBGL_UNSIGNED_INT_5_9_9_9_REV\fR and \fIformat\fR is neither \fBGL_RGBA\fR or \fBGL_BGRA\fR\&. .PP \fBGL_INVALID_OPERATION\fR is generated if a non\-zero buffer object name is bound to the \fBGL_PIXEL_PACK_BUFFER\fR target and the buffer object\*(Aqs data store is currently mapped\&. .PP \fBGL_INVALID_OPERATION\fR is generated if a non\-zero buffer object name is bound to the \fBGL_PIXEL_PACK_BUFFER\fR target and the data would be packed to the buffer object such that the memory writes required would exceed the data store size\&. .PP \fBGL_INVALID_OPERATION\fR is generated if a non\-zero buffer object name is bound to the \fBGL_PIXEL_PACK_BUFFER\fR target and \fIimg\fR is not evenly divisible into the number of bytes needed to store in memory a datum indicated by \fItype\fR\&. .SH "ASSOCIATED GETS" .PP \fBglGetTexLevelParameter\fR() with argument \fBGL_TEXTURE_WIDTH\fR .PP \fBglGetTexLevelParameter\fR() with argument \fBGL_TEXTURE_HEIGHT\fR .PP \fBglGetTexLevelParameter\fR() with argument \fBGL_TEXTURE_INTERNAL_FORMAT\fR .PP \fBglGet\fR() with arguments \fBGL_PACK_ALIGNMENT\fR and others .PP \fBglGet\fR() with argument \fBGL_PIXEL_PACK_BUFFER_BINDING\fR .SH "SEE ALSO" .PP \fBglActiveTexture\fR(), \fBglReadPixels\fR(), \fBglTexImage1D\fR(), \fBglTexImage2D\fR(), \fBglTexImage3D\fR(), \fBglTexSubImage1D\fR(), \fBglTexSubImage2D\fR(), \fBglTexSubImage3D\fR(), \fBglTexParameter\fR() .SH "COPYRIGHT" .PP Copyright \(co 1991\-2006 Silicon Graphics, Inc\&. Copyright \(co 2010 Khronos Group\&. This document is licensed under the SGI Free Software B License\&. For details, see \m[blue]\fBhttp://oss\&.sgi\&.com/projects/FreeB/\fR\m[]\&.