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

NAME

6       glTexImage3D - specify a three-dimensional texture image
7

C SPECIFICATION

9       void glTexImage3D(GLenum target, GLint level, GLint internalFormat,
10                         GLsizei width, GLsizei height, GLsizei depth,
11                         GLint border, GLenum format, GLenum type,
12                         const GLvoid * data);
13

PARAMETERS

15       target
16           Specifies the target texture. Must be one of GL_TEXTURE_3D,
17           GL_PROXY_TEXTURE_3D, GL_TEXTURE_2D_ARRAY or
18           GL_PROXY_TEXTURE_2D_ARRAY.
19
20       level
21           Specifies the level-of-detail number. Level 0 is the base image
22           level. Level n is the n th mipmap reduction image.
23
24       internalFormat
25           Specifies the number of color components in the texture. Must be
26           one of base internal formats given in Table 1, one of the sized
27           internal formats given in Table 2, or one of the compressed
28           internal formats given in Table 3, below.
29
30       width
31           Specifies the width of the texture image. All implementations
32           support 3D texture images that are at least 16 texels wide.
33
34       height
35           Specifies the height of the texture image. All implementations
36           support 3D texture images that are at least 256 texels high.
37
38       depth
39           Specifies the depth of the texture image, or the number of layers
40           in a texture array. All implementations support 3D texture images
41           that are at least 256 texels deep, and texture arrays that are at
42           least 256 layers deep.
43
44       border
45           This value must be 0.
46
47       format
48           Specifies the format of the pixel data. The following symbolic
49           values are accepted: GL_RED, GL_RG, GL_RGB, GL_BGR, GL_RGBA, and
50           GL_BGRA.
51
52       type
53           Specifies the data type of the pixel data. The following symbolic
54           values are accepted: GL_UNSIGNED_BYTE, GL_BYTE, GL_UNSIGNED_SHORT,
55           GL_SHORT, GL_UNSIGNED_INT, GL_INT, GL_FLOAT,
56           GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
57           GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
58           GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
59           GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
60           GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV,
61           GL_UNSIGNED_INT_10_10_10_2, and GL_UNSIGNED_INT_2_10_10_10_REV.
62
63       data
64           Specifies a pointer to the image data in memory.
65

DESCRIPTION

67       Texturing maps a portion of a specified texture image onto each
68       graphical primitive for which texturing is enabled. To enable and
69       disable three-dimensional texturing, call glEnable() and glDisable()
70       with argument GL_TEXTURE_3D.
71
72       To define texture images, call glTexImage3D. The arguments describe the
73       parameters of the texture image, such as height, width, depth, width of
74       the border, level-of-detail number (see glTexParameter()), and number
75       of color components provided. The last three arguments describe how the
76       image is represented in memory.
77
78       If target is GL_PROXY_TEXTURE_3D, no data is read from data, but all of
79       the texture image state is recalculated, checked for consistency, and
80       checked against the implementation's capabilities. If the
81       implementation cannot handle a texture of the requested texture size,
82       it sets all of the image state to 0, but does not generate an error
83       (see glGetError()). To query for an entire mipmap array, use an image
84       array level greater than or equal to 1.
85
86       If target is GL_TEXTURE_3D, data is read from data as a sequence of
87       signed or unsigned bytes, shorts, or longs, or single-precision
88       floating-point values, depending on type. These values are grouped into
89       sets of one, two, three, or four values, depending on format, to form
90       elements. Each data byte is treated as eight 1-bit elements, with bit
91       ordering determined by GL_UNPACK_LSB_FIRST (see glPixelStore()).
92
93       If a non-zero named buffer object is bound to the
94       GL_PIXEL_UNPACK_BUFFER target (see glBindBuffer()) while a texture
95       image is specified, data is treated as a byte offset into the buffer
96       object's data store.
97
98       The first element corresponds to the lower left corner of the texture
99       image. Subsequent elements progress left-to-right through the remaining
100       texels in the lowest row of the texture image, and then in successively
101       higher rows of the texture image. The final element corresponds to the
102       upper right corner of the texture image.
103
104       format determines the composition of each element in data. It can
105       assume one of these symbolic values:
106
107       GL_RED
108           Each element is a single red component. The GL converts it to
109           floating point and assembles it into an RGBA element by attaching 0
110           for green and blue, and 1 for alpha. Each component is then
111           multiplied by the signed scale factor GL_c_SCALE, added to the
112           signed bias GL_c_BIAS, and clamped to the range [0,1].
113
114       GL_RG
115           Each element is a red and green pair. The GL converts each to
116           floating point and assembles it into an RGBA element by attaching 0
117           for blue, and 1 for alpha. Each component is then multiplied by the
118           signed scale factor GL_c_SCALE, added to the signed bias GL_c_BIAS,
119           and clamped to the range [0,1].
120
121       GL_RGB
122
123       GL_BGR
124           Each element is an RGB triple. The GL converts it to floating point
125           and assembles it into an RGBA element by attaching 1 for alpha.
126           Each component is then multiplied by the signed scale factor
127           GL_c_SCALE, added to the signed bias GL_c_BIAS, and clamped to the
128           range [0,1].
129
130       GL_RGBA
131
132       GL_BGRA
133           Each element contains all four components. Each component is
134           multiplied by the signed scale factor GL_c_SCALE, added to the
135           signed bias GL_c_BIAS, and clamped to the range [0,1].
136
137       If an application wants to store the texture at a certain resolution or
138       in a certain format, it can request the resolution and format with
139       internalFormat. The GL will choose an internal representation that
140       closely approximates that requested by internalFormat, but it may not
141       match exactly. (The representations specified by GL_RED, GL_RG, GL_RGB,
142       and GL_RGBA must match exactly.)
143
144       internalFormat may be one of the base internal formats shown in Table
145       1, below
146
147       <xi:include></xi:include>
148
149       internalFormat may also be one of the sized internal formats shown in
150       Table 2, below
151
152       <xi:include></xi:include>
153
154       Finally, internalFormat may also be one of the generic or compressed
155       compressed texture formats shown in Table 3 below
156
157       <xi:include></xi:include>
158
159       If the internalFormat parameter is one of the generic compressed
160       formats, GL_COMPRESSED_RED, GL_COMPRESSED_RG, GL_COMPRESSED_RGB, or
161       GL_COMPRESSED_RGBA, the GL will replace the internal format with the
162       symbolic constant for a specific internal format and compress the
163       texture before storage. If no corresponding internal format is
164       available, or the GL can not compress that image for any reason, the
165       internal format is instead replaced with a corresponding base internal
166       format.
167
168       If the internalFormat parameter is GL_SRGB, GL_SRGB8, GL_SRGB_ALPHA, or
169       GL_SRGB8_ALPHA8, the texture is treated as if the red, green, blue, or
170       luminance components are encoded in the sRGB color space. Any alpha
171       component is left unchanged. The conversion from the sRGB encoded
172       component c s to a linear component c l is:
173
174       c l = { c s 12.92 if c s ≤ 0.04045 ( c s + 0.055 1.055 ) 2.4 if c s >
175       0.04045
176
177       Assume c s is the sRGB component in the range [0,1].
178
179       Use the GL_PROXY_TEXTURE_3D target to try out a resolution and format.
180       The implementation will update and recompute its best match for the
181       requested storage resolution and format. To then query this state, call
182       glGetTexLevelParameter(). If the texture cannot be accommodated,
183       texture state is set to 0.
184
185       A one-component texture image uses only the red component of the RGBA
186       color extracted from data. A two-component image uses the R and A
187       values. A three-component image uses the R, G, and B values. A
188       four-component image uses all of the RGBA components.
189

NOTES

191       The glPixelStore() mode affects texture images.
192
193       data may be a null pointer. In this case texture memory is allocated to
194       accommodate a texture of width width, height height, and depth depth.
195       You can then download subtextures to initialize this texture memory.
196       The image is undefined if the user tries to apply an uninitialized
197       portion of the texture image to a primitive.
198
199       glTexImage3D specifies the three-dimensional texture for the current
200       texture unit, specified with glActiveTexture().
201

ERRORS

203       GL_INVALID_ENUM is generated if target is not GL_TEXTURE_3D or
204       GL_PROXY_TEXTURE_3D.
205
206       GL_INVALID_ENUM is generated if format is not an accepted format
207       constant. Format constants other than GL_STENCIL_INDEX and
208       GL_DEPTH_COMPONENT are accepted.
209
210       GL_INVALID_ENUM is generated if type is not a type constant.
211
212       GL_INVALID_VALUE is generated if level is less than 0.
213
214       GL_INVALID_VALUE may be generated if level is greater than log 2 ⁡ max,
215       where max is the returned value of GL_MAX_TEXTURE_SIZE.
216
217       GL_INVALID_VALUE is generated if internalFormat is not one of the
218       accepted resolution and format symbolic constants.
219
220       GL_INVALID_VALUE is generated if width, height, or depth is less than 0
221       or greater than GL_MAX_TEXTURE_SIZE.
222
223       GL_INVALID_VALUE is generated if non-power-of-two textures are not
224       supported and the width, height, or depth cannot be represented as 2 k
225       + 2 ⁡ border for some integer value of k.
226
227       GL_INVALID_VALUE is generated if border is not 0 or 1.
228
229       GL_INVALID_OPERATION is generated if type is one of
230       GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
231       GL_UNSIGNED_SHORT_5_6_5, or GL_UNSIGNED_SHORT_5_6_5_REV and format is
232       not GL_RGB.
233
234       GL_INVALID_OPERATION is generated if type is one of
235       GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
236       GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
237       GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV,
238       GL_UNSIGNED_INT_10_10_10_2, or GL_UNSIGNED_INT_2_10_10_10_REV and
239       format is neither GL_RGBA nor GL_BGRA.
240
241       GL_INVALID_OPERATION is generated if format or internalFormat is
242       GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, or
243       GL_DEPTH_COMPONENT32.
244
245       GL_INVALID_OPERATION is generated if a non-zero buffer object name is
246       bound to the GL_PIXEL_UNPACK_BUFFER target and the buffer object's data
247       store is currently mapped.
248
249       GL_INVALID_OPERATION is generated if a non-zero buffer object name is
250       bound to the GL_PIXEL_UNPACK_BUFFER target and the data would be
251       unpacked from the buffer object such that the memory reads required
252       would exceed the data store size.
253
254       GL_INVALID_OPERATION is generated if a non-zero buffer object name is
255       bound to the GL_PIXEL_UNPACK_BUFFER target and data is not evenly
256       divisible into the number of bytes needed to store in memory a datum
257       indicated by type.
258

ASSOCIATED GETS

260       glGetTexImage()
261
262       glGet() with argument GL_PIXEL_UNPACK_BUFFER_BINDING
263

SEE ALSO

265       glActiveTexture(), glCompressedTexImage1D(), glCompressedTexImage2D(),
266       glCompressedTexImage3D(), glCompressedTexSubImage1D(),
267       glCompressedTexSubImage2D(), glCompressedTexSubImage3D(),
268       glCopyTexImage1D(), glCopyTexImage2D(), glCopyTexSubImage1D(),
269       glCopyTexSubImage2D(), glCopyTexSubImage3D(),
270       glGetCompressedTexImage(), glPixelStore(), glTexImage1D(),
271       glTexImage2D(), glTexSubImage1D(), glTexSubImage2D(),
272       glTexSubImage3D(), glTexParameter()
273
275       Copyright © 1991-2006 Silicon Graphics, Inc. Copyright © 2011 Khronos
276       Group. This document is licensed under the SGI Free Software B License.
277       For details, see http://oss.sgi.com/projects/FreeB/.
278

AUTHORS

280       opengl.org
281
282
283
284opengl.org                        06/10/2014                  GLTEXIMAGE3D(3G)
Impressum