1GLGETTEXIMAGE(3G)                OpenGL Manual               GLGETTEXIMAGE(3G)
2
3
4

NAME

6       glGetTexImage - return a texture image
7

C SPECIFICATION

9       void glGetTexImage(GLenum target, GLint level, GLenum format,
10                          GLenum type, GLvoid * img);
11

PARAMETERS

13       target
14           Specifies which texture is to be obtained.  GL_TEXTURE_1D,
15           GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_1D_ARRAY,
16           GL_TEXTURE_2D_ARRAY, GL_TEXTURE_RECTANGLE,
17           GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
18           GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
19           GL_TEXTURE_CUBE_MAP_POSITIVE_Z, and GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
20           are accepted.
21
22       level
23           Specifies the level-of-detail number of the desired image. Level 0
24           is the base image level. Level n is the nth mipmap reduction image.
25
26       format
27           Specifies a pixel format for the returned data. The supported
28           formats are GL_STENCIL_INDEX, GL_DEPTH_COMPONENT, GL_DEPTH_STENCIL,
29           GL_RED, GL_GREEN, GL_BLUE, GL_RG, GL_RGB, GL_RGBA, GL_BGR, GL_BGRA,
30           GL_RED_INTEGER, GL_GREEN_INTEGER, GL_BLUE_INTEGER, GL_RG_INTEGER,
31           GL_RGB_INTEGER, GL_RGBA_INTEGER, GL_BGR_INTEGER, GL_BGRA_INTEGER.
32
33       type
34           Specifies a pixel type for the returned data. The supported types
35           are GL_UNSIGNED_BYTE, GL_BYTE, GL_UNSIGNED_SHORT, GL_SHORT,
36           GL_UNSIGNED_INT, GL_INT, GL_HALF_FLOAT, GL_FLOAT,
37           GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
38           GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
39           GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
40           GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
41           GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV,
42           GL_UNSIGNED_INT_10_10_10_2, GL_UNSIGNED_INT_2_10_10_10_REV,
43           GL_UNSIGNED_INT_24_8, GL_UNSIGNED_INT_10F_11F_11F_REV,
44           GL_UNSIGNED_INT_5_9_9_9_REV, and GL_FLOAT_32_UNSIGNED_INT_24_8_REV.
45
46       img
47           Returns the texture image. Should be a pointer to an array of the
48           type specified by type.
49

DESCRIPTION

51       glGetTexImage returns a texture image into img.  target specifies
52       whether the desired texture image is one specified by glTexImage1D()
53       (GL_TEXTURE_1D), glTexImage2D() (GL_TEXTURE_1D_ARRAY,
54       GL_TEXTURE_RECTANGLE, GL_TEXTURE_2D or any of GL_TEXTURE_CUBE_MAP_*),
55       or glTexImage3D() (GL_TEXTURE_2D_ARRAY, GL_TEXTURE_3D).  level
56       specifies the level-of-detail number of the desired image.  format and
57       type specify the format and type of the desired image array. See the
58       reference page for glTexImage1D() for a description of the acceptable
59       values for the format and type parameters, respectively.
60
61       If a non-zero named buffer object is bound to the GL_PIXEL_PACK_BUFFER
62       target (see glBindBuffer()) while a texture image is requested, img is
63       treated as a byte offset into the buffer object's data store.
64
65       To understand the operation of glGetTexImage, consider the selected
66       internal four-component texture image to be an RGBA color buffer the
67       size of the image. The semantics of glGetTexImage are then identical to
68       those of glReadPixels(), with the exception that no pixel transfer
69       operations are performed, when called with the same format and type,
70       with x and y set to 0, width set to the width of the texture image and
71       height set to 1 for 1D images, or to the height of the texture image
72       for 2D images.
73
74       If the selected texture image does not contain four components, the
75       following mappings are applied. Single-component textures are treated
76       as RGBA buffers with red set to the single-component value, green set
77       to 0, blue set to 0, and alpha set to 1. Two-component textures are
78       treated as RGBA buffers with red set to the value of component zero,
79       alpha set to the value of component one, and green and blue set to 0.
80       Finally, three-component textures are treated as RGBA buffers with red
81       set to component zero, green set to component one, blue set to
82       component two, and alpha set to 1.
83
84       To determine the required size of img, use glGetTexLevelParameter() to
85       determine the dimensions of the internal texture image, then scale the
86       required number of pixels by the storage required for each pixel, based
87       on format and type. Be sure to take the pixel storage parameters into
88       account, especially GL_PACK_ALIGNMENT.
89

NOTES

91       If an error is generated, no change is made to the contents of img.
92
93       glGetTexImage returns the texture image for the active texture unit.
94

ERRORS

96       GL_INVALID_ENUM is generated if target, format, or type is not an
97       accepted value.
98
99       GL_INVALID_VALUE is generated if level is less than 0.
100
101       GL_INVALID_VALUE may be generated if level is greater than log 2 ⁡ max,
102       where max is the returned value of GL_MAX_TEXTURE_SIZE.
103
104       GL_INVALID_OPERATION is returned if type is one of
105       GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
106       GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, or
107       GL_UNSIGNED_INT_10F_11F_11F_REV and format is not GL_RGB.
108
109       GL_INVALID_OPERATION is returned if type is one of
110       GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
111       GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
112       GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV,
113       GL_UNSIGNED_INT_10_10_10_2, GL_UNSIGNED_INT_2_10_10_10_REV, or
114       GL_UNSIGNED_INT_5_9_9_9_REV and format is neither GL_RGBA or GL_BGRA.
115
116       GL_INVALID_OPERATION is generated if a non-zero buffer object name is
117       bound to the GL_PIXEL_PACK_BUFFER target and the buffer object's data
118       store is currently mapped.
119
120       GL_INVALID_OPERATION is generated if a non-zero buffer object name is
121       bound to the GL_PIXEL_PACK_BUFFER target and the data would be packed
122       to the buffer object such that the memory writes required would exceed
123       the data store size.
124
125       GL_INVALID_OPERATION is generated if a non-zero buffer object name is
126       bound to the GL_PIXEL_PACK_BUFFER target and img is not evenly
127       divisible into the number of bytes needed to store in memory a datum
128       indicated by type.
129

ASSOCIATED GETS

131       glGetTexLevelParameter() with argument GL_TEXTURE_WIDTH
132
133       glGetTexLevelParameter() with argument GL_TEXTURE_HEIGHT
134
135       glGetTexLevelParameter() with argument GL_TEXTURE_INTERNAL_FORMAT
136
137       glGet() with arguments GL_PACK_ALIGNMENT and others
138
139       glGet() with argument GL_PIXEL_PACK_BUFFER_BINDING
140

SEE ALSO

142       glActiveTexture(), glReadPixels(), glTexImage1D(), glTexImage2D(),
143       glTexImage3D(), glTexSubImage1D(), glTexSubImage2D(),
144       glTexSubImage3D(), glTexParameter()
145
147       Copyright © 1991-2006 Silicon Graphics, Inc. Copyright © 2010 Khronos
148       Group. This document is licensed under the SGI Free Software B License.
149       For details, see http://oss.sgi.com/projects/FreeB/.
150

AUTHORS

152       opengl.org
153
154
155
156opengl.org                        06/10/2014                 GLGETTEXIMAGE(3G)
Impressum