'\" t .\" Title: glGetTexImage .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 01/03/2018 .\" Manual: [FIXME: manual] .\" Source: [FIXME: source] .\" Language: English .\" .TH "GLGETTEXIMAGE" "3G" "01/03/2018" "[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, glGetnTexImage, glGetTextureImage \- return a texture image .SH "C SPECIFICATION" .HP \w'void\ glGetTexImage('u .BI "void glGetTexImage(GLenum\ " "target" ", GLint\ " "level" ", GLenum\ " "format" ", GLenum\ " "type" ", GLvoid\ *\ " "pixels" ");" .HP \w'void\ glGetnTexImage('u .BI "void glGetnTexImage(GLenum\ " "target" ", GLint\ " "level" ", GLenum\ " "format" ", GLenum\ " "type" ", GLsizei\ " "bufSize" ", void\ *" "pixels" ");" .HP \w'void\ glGetTextureImage('u .BI "void glGetTextureImage(GLuint\ " "texture" ", GLint\ " "level" ", GLenum\ " "format" ", GLenum\ " "type" ", GLsizei\ " "bufSize" ", void\ *" "pixels" ");" .SH "PARAMETERS" .PP \fItarget\fR .RS 4 Specifies the target to which the texture is bound for \fBglGetTexImage\fR and \fBglGetnTexImage\fR functions\&. \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, \fBGL_TEXTURE_CUBE_MAP_NEGATIVE_Z\fR, and GL_TEXTURE_CUBE_MAP_ARRAY are acceptable\&. .RE .PP \fItexture\fR .RS 4 Specifies the texture object name\&. .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 \fIbufSize\fR .RS 4 Specifies the size of the buffer \fIpixels\fR for \fBglGetnTexImage\fR and \fBglGetTextureImage\fR functions\&. .RE .PP \fIpixels\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, \fBglGetnTexImage\fR and \fBglGetTextureImage\fR functions return a texture image into \fIpixels\fR\&. For \fBglGetTexImage\fR and \fBglGetnTexImage\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, \fBGL_TEXTURE_CUBE_MAP_ARRAY\fR)\&. For \fBglGetTextureImage\fR, \fItexture\fR specifies the texture object name\&. In addition to types of textures accepted by \fBglGetTexImage\fR and \fBglGetnTexImage\fR, the function also accepts cube map texture objects (with effective target \fBGL_TEXTURE_CUBE_MAP\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\&. For glGetnTexImage and glGetTextureImage functions, bufSize tells the size of the buffer to receive the retrieved pixel data\&. \fBglGetnTexImage\fR and \fBglGetTextureImage\fR do not write more than \fIbufSize\fR bytes into \fIpixels\fR\&. .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, \fIpixels\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 \fIpixels\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\&. .PP If \fBglGetTextureImage\fR is used against a cube map texture object, the texture is treated as a three\-dimensional image of a depth of 6, where the cube map faces are ordered as image layers, in an order presented in the table below: .TS allbox tab(:); cB cB. T{ Layer number T}:T{ Cube Map Face T} .T& l l l l l l l l l l l l. T{ 0 T}:T{ GL_TEXTURE_CUBE_MAP_POSITIVE_X T} T{ 1 T}:T{ GL_TEXTURE_CUBE_MAP_NEGATIVE_X T} T{ 2 T}:T{ GL_TEXTURE_CUBE_MAP_POSITIVE_Y T} T{ 3 T}:T{ GL_TEXTURE_CUBE_MAP_NEGATIVE_Y T} T{ 4 T}:T{ GL_TEXTURE_CUBE_MAP_POSITIVE_Z T} T{ 5 T}:T{ GL_TEXTURE_CUBE_MAP_NEGATIVE_Z T} .TE .sp 1 .SH "NOTES" .PP If an error is generated, no change is made to the contents of \fIpixels\fR\&. .PP \fBglGetTexImage\fR and \fBglGetnTexImage\fR return the texture image for the active texture unit\&. .PP \fBGL_STENCIL_INDEX\fR is accepted for \fIformat\fR only if the GL version is 4\&.4 or greater\&. .SH "ERRORS" .PP \fBGL_INVALID_ENUM\fR is generated by \fBglGetTexImage\fR and \fBglGetnTexImage\fR functions if \fItarget\fR is not an accepted value\&. These include: .PP .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBGL_TEXTURE_1D\fR, \fBGL_TEXTURE_2D\fR, \fBGL_TEXTURE_3D\fR, \fBGL_TEXTURE_1D_ARRAY\fR, \fBGL_TEXTURE_2D_ARRAY\fR, \fBGL_TEXTURE_CUBE_MAP_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 for \fBglGetTexImage\fR and \fBglGetnTexImage\fR functions\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBGL_TEXTURE_1D\fR, \fBGL_TEXTURE_2D\fR, \fBGL_TEXTURE_3D\fR, \fBGL_TEXTURE_1D_ARRAY\fR, \fBGL_TEXTURE_2D_ARRAY\fR, \fBGL_TEXTURE_CUBE_MAP_ARRAY\fR, \fBGL_TEXTURE_RECTANGLE\fR, and \fBGL_TEXTURE_CUBE_MAP\fR for \fBglGetTextureImage\fR function\&. .RE .PP \fBGL_INVALID_OPERATION\fR is generated by \fBglGetTextureImage\fR if \fItexture\fR is not the name of an existing texture object\&. .PP \fBGL_INVALID_ENUM\fR is generated if \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_VALUE\fR is generated if \fIlevel\fR is non\-zero and the effective target is \fBGL_TEXTURE_RECTANGLE\fR\&. .PP \fBGL_INVALID_OPERATION\fR is generated 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 generated 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 \fIformat\fR is \fBGL_STENCIL_INDEX\fR and the base internal format is not \fBGL_STENCIL_INDEX\fR or \fBGL_DEPTH_STENCIL\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 \fIpixels\fR is not evenly divisible into the number of bytes needed to store in memory a datum indicated by \fItype\fR\&. .PP \fBGL_INVALID_OPERATION\fR is generated by \fBglGetTextureImage\fR and \fBglGetnTexImage\fR if the buffer size required to store the requested data is greater than \fIbufSize\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 "VERSION SUPPORT" .TS allbox tab(:); lB cB s s s s s s s s s s s lB cB cB cB cB cB cB cB cB cB cB cB cB. T{ T}:T{ \fBOpenGL Version\fR T} T{ \fBFunction / Feature Name\fR T}:T{ \fB2\&.0\fR T}:T{ \fB2\&.1\fR T}:T{ \fB3\&.0\fR T}:T{ \fB3\&.1\fR T}:T{ \fB3\&.2\fR T}:T{ \fB3\&.3\fR T}:T{ \fB4\&.0\fR T}:T{ \fB4\&.1\fR T}:T{ \fB4\&.2\fR T}:T{ \fB4\&.3\fR T}:T{ \fB4\&.4\fR T}:T{ \fB4\&.5\fR T} .T& l c c c c c c c c c c c c l c c c c c c c c c c c c l c c c c c c c c c c c c. T{ \fBglGetTexImage\fR T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T} T{ \fBglGetTextureImage\fR T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ ✔ T} T{ \fBglGetnTexImage\fR T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ \- T}:T{ ✔ T} .TE .sp 1 .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\-2014 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[]\&. .SH "COPYRIGHT" .br Copyright \(co 1991-2006 Silicon Graphics, Inc. .br Copyright \(co 2010-2014 Khronos Group .br