1GLTEXIMAGE2D(3G)                [FIXME: manual]               GLTEXIMAGE2D(3G)
2
3
4

NAME

6       glTexImage2D - specify a two-dimensional texture image
7

C SPECIFICATION

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

PARAMETERS

14       target
15           Specifies the target texture. Must be GL_TEXTURE_2D,
16           GL_PROXY_TEXTURE_2D, GL_TEXTURE_1D_ARRAY,
17           GL_PROXY_TEXTURE_1D_ARRAY, GL_TEXTURE_RECTANGLE,
18           GL_PROXY_TEXTURE_RECTANGLE, GL_TEXTURE_CUBE_MAP_POSITIVE_X,
19           GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
20           GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
21           GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, or GL_PROXY_TEXTURE_CUBE_MAP.
22
23       level
24           Specifies the level-of-detail number. Level 0 is the base image
25           level. Level n is the nth mipmap reduction image. If target is
26           GL_TEXTURE_RECTANGLE or GL_PROXY_TEXTURE_RECTANGLE, level must be
27           0.
28
29       internalFormat
30           Specifies the number of color components in the texture. Must be
31           one of base internal formats given in Table 1, one of the sized
32           internal formats given in Table 2, or one of the compressed
33           internal formats given in Table 3, below.
34
35       width
36           Specifies the width of the texture image. All implementations
37           support texture images that are at least 1024 texels wide.
38
39       height
40           Specifies the height of the texture image, or the number of layers
41           in a texture array, in the case of the GL_TEXTURE_1D_ARRAY and
42           GL_PROXY_TEXTURE_1D_ARRAY targets. All implementations support 2D
43           texture images that are at least 1024 texels high, and texture
44           arrays that are at least 256 layers deep.
45
46       border
47           This value must be 0.
48
49       format
50           Specifies the format of the pixel data. The following symbolic
51           values are accepted: GL_RED, GL_RG, GL_RGB, GL_BGR, GL_RGBA,
52           GL_BGRA, GL_RED_INTEGER, GL_RG_INTEGER, GL_RGB_INTEGER,
53           GL_BGR_INTEGER, GL_RGBA_INTEGER, GL_BGRA_INTEGER, GL_STENCIL_INDEX,
54           GL_DEPTH_COMPONENT, GL_DEPTH_STENCIL.
55
56       type
57           Specifies the data type of the pixel data. The following symbolic
58           values are accepted: GL_UNSIGNED_BYTE, GL_BYTE, GL_UNSIGNED_SHORT,
59           GL_SHORT, GL_UNSIGNED_INT, GL_INT, GL_FLOAT,
60           GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
61           GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
62           GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
63           GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
64           GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV,
65           GL_UNSIGNED_INT_10_10_10_2, and GL_UNSIGNED_INT_2_10_10_10_REV.
66
67       data
68           Specifies a pointer to the image data in memory.
69

DESCRIPTION

71       Texturing allows elements of an image array to be read by shaders.
72
73       To define texture images, call glTexImage2D. The arguments describe the
74       parameters of the texture image, such as height, width, width of the
75       border, level-of-detail number (see glTexParameter()), and number of
76       color components provided. The last three arguments describe how the
77       image is represented in memory.
78
79       If target is GL_PROXY_TEXTURE_2D, GL_PROXY_TEXTURE_1D_ARRAY,
80       GL_PROXY_TEXTURE_CUBE_MAP, or GL_PROXY_TEXTURE_RECTANGLE, no data is
81       read from data, but all of the texture image state is recalculated,
82       checked for consistency, and checked against the implementation's
83       capabilities. If the implementation cannot handle a texture of the
84       requested texture size, it sets all of the image state to 0, but does
85       not generate an error (see glGetError()). To query for an entire mipmap
86       array, use an image array level greater than or equal to 1.
87
88       If target is GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE or one of the
89       GL_TEXTURE_CUBE_MAP targets, data is read from data as a sequence of
90       signed or unsigned bytes, shorts, or longs, or single-precision
91       floating-point values, depending on type. These values are grouped into
92       sets of one, two, three, or four values, depending on format, to form
93       elements. Each data byte is treated as eight 1-bit elements, with bit
94       ordering determined by GL_UNPACK_LSB_FIRST (see glPixelStore()).
95
96       If target is GL_TEXTURE_1D_ARRAY, data is interpreted as an array of
97       one-dimensional images.
98
99       If a non-zero named buffer object is bound to the
100       GL_PIXEL_UNPACK_BUFFER target (see glBindBuffer()) while a texture
101       image is specified, data is treated as a byte offset into the buffer
102       object's data store.
103
104       The first element corresponds to the lower left corner of the texture
105       image. Subsequent elements progress left-to-right through the remaining
106       texels in the lowest row of the texture image, and then in successively
107       higher rows of the texture image. The final element corresponds to the
108       upper right corner of the texture image.
109
110       format determines the composition of each element in data. It can
111       assume one of these symbolic values:
112
113       GL_RED
114           Each element is a single red component. The GL converts it to
115           floating point and assembles it into an RGBA element by attaching 0
116           for green and blue, and 1 for alpha. Each component is clamped to
117           the range [0,1].
118
119       GL_RG
120           Each element is a red/green double. The GL converts it to floating
121           point and assembles it into an RGBA element by attaching 0 for
122           blue, and 1 for alpha. Each component is clamped to the range
123           [0,1].
124
125       GL_RGB, GL_BGR
126           Each element is an RGB triple. The GL converts it to floating point
127           and assembles it into an RGBA element by attaching 1 for alpha.
128           Each component is clamped to the range [0,1].
129
130       GL_RGBA, GL_BGRA
131           Each element contains all four components. Each component is
132           clamped to the range [0,1].
133
134       GL_DEPTH_COMPONENT
135           Each element is a single depth value. The GL converts it to
136           floating point and clamps to the range [0,1].
137
138       GL_DEPTH_STENCIL
139           Each element is a pair of depth and stencil values. The depth
140           component of the pair is interpreted as in GL_DEPTH_COMPONENT. The
141           stencil component is interpreted based on specified the depth +
142           stencil internal format.
143
144       If an application wants to store the texture at a certain resolution or
145       in a certain format, it can request the resolution and format with
146       internalFormat. The GL will choose an internal representation that
147       closely approximates that requested by internalFormat, but it may not
148       match exactly. (The representations specified by GL_RED, GL_RG, GL_RGB,
149       and GL_RGBA must match exactly.)
150
151       internalFormat may be one of the base internal formats shown in Table
152       1, below
153
154       Table 1. Base Internal Formats
155       ┌───────────────────┬───────────────────┬─────────────────────┐
156Base Internal      RGBA, Depth and   Internal Components 
157Format             Stencil Values    │                     │
158       ├───────────────────┼───────────────────┼─────────────────────┤
159GL_DEPTH_COMPONENT │ Depth             │ D                   │
160       ├───────────────────┼───────────────────┼─────────────────────┤
161GL_DEPTH_STENCIL   │ Depth, Stencil    │ D, S                │
162       ├───────────────────┼───────────────────┼─────────────────────┤
163GL_RED             │ Red               │ R                   │
164       ├───────────────────┼───────────────────┼─────────────────────┤
165GL_RG              │ Red, Green        │ R, G                │
166       ├───────────────────┼───────────────────┼─────────────────────┤
167GL_RGB             │ Red, Green, Blue  │ R, G, B             │
168       ├───────────────────┼───────────────────┼─────────────────────┤
169GL_RGBA            │ Red, Green, Blue, │ R, G, B, A          │
170       │                   │ Alpha             │                     │
171       └───────────────────┴───────────────────┴─────────────────────┘
172
173       internalFormat may also be one of the sized internal formats shown in
174       Table 2, below
175
176       Table 2. Sized Internal Formats
177       ┌──────────────────┬──────────┬──────────┬────────────┬───────────┬────────────┬────────┐
178Sized             Base     Red Bits Green Bits Blue Bits Alpha Bits Shared 
179Internal          Internal │          │            │           │            │ Bits   
180Format            Format   │          │            │           │            │        │
181       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
182GL_R8             GL_RED   │    8     │            │           │            │        │
183       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
184GL_R8_SNORM       GL_RED   │    s8    │            │           │            │        │
185       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
186GL_R16            GL_RED   │    16    │            │           │            │        │
187       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
188GL_R16_SNORM      GL_RED   │   s16    │            │           │            │        │
189       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
190GL_RG8            GL_RG    │    8     │     8      │           │            │        │
191       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
192GL_RG8_SNORM      GL_RG    │    s8    │     s8     │           │            │        │
193       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
194GL_RG16           GL_RG    │    16    │     16     │           │            │        │
195       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
196GL_RG16_SNORM     GL_RG    │   s16    │    s16     │           │            │        │
197       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
198GL_R3_G3_B2       GL_RGB   │    3     │     3      │     2     │            │        │
199       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
200GL_RGB4           GL_RGB   │    4     │     4      │     4     │            │        │
201       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
202GL_RGB5           GL_RGB   │    5     │     5      │     5     │            │        │
203       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
204GL_RGB8           GL_RGB   │    8     │     8      │     8     │            │        │
205       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
206GL_RGB8_SNORM     GL_RGB   │    s8    │     s8     │    s8     │            │        │
207       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
208GL_RGB10          GL_RGB   │    10    │     10     │    10     │            │        │
209       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
210GL_RGB12          GL_RGB   │    12    │     12     │    12     │            │        │
211       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
212GL_RGB16_SNORM    GL_RGB   │    16    │     16     │    16     │            │        │
213       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
214GL_RGBA2          GL_RGB   │    2     │     2      │     2     │     2      │        │
215       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
216GL_RGBA4          GL_RGB   │    4     │     4      │     4     │     4      │        │
217       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
218GL_RGB5_A1        GL_RGBA  │    5     │     5      │     5     │     1      │        │
219       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
220GL_RGBA8          GL_RGBA  │    8     │     8      │     8     │     8      │        │
221       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
222GL_RGBA8_SNORM    GL_RGBA  │    s8    │     s8     │    s8     │     s8     │        │
223       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
224GL_RGB10_A2       GL_RGBA  │    10    │     10     │    10     │     2      │        │
225       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
226GL_RGB10_A2UI     GL_RGBA  │   ui10   │    ui10    │   ui10    │    ui2     │        │
227       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
228GL_RGBA12         GL_RGBA  │    12    │     12     │    12     │     12     │        │
229       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
230GL_RGBA16         GL_RGBA  │    16    │     16     │    16     │     16     │        │
231       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
232GL_SRGB8          GL_RGB   │    8     │     8      │     8     │            │        │
233       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
234GL_SRGB8_ALPHA8   GL_RGBA  │    8     │     8      │     8     │     8      │        │
235       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
236GL_R16F           GL_RED   │   f16    │            │           │            │        │
237       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
238GL_RG16F          GL_RG    │   f16    │    f16     │           │            │        │
239       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
240GL_RGB16F         GL_RGB   │   f16    │    f16     │    f16    │            │        │
241       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
242GL_RGBA16F        GL_RGBA  │   f16    │    f16     │    f16    │    f16     │        │
243       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
244GL_R32F           GL_RED   │   f32    │            │           │            │        │
245       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
246GL_RG32F          GL_RG    │   f32    │    f32     │           │            │        │
247       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
248GL_RGB32F         GL_RGB   │   f32    │    f32     │    f32    │            │        │
249       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
250GL_RGBA32F        GL_RGBA  │   f32    │    f32     │    f32    │    f32     │        │
251       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
252GL_R11F_G11F_B10F GL_RGB   │   f11    │    f11     │    f10    │            │        │
253       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
254GL_RGB9_E5        GL_RGB   │    9     │     9      │     9     │            │   5    │
255       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
256GL_R8I            GL_RED   │    i8    │            │           │            │        │
257       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
258GL_R8UI           GL_RED   │   ui8    │            │           │            │        │
259       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
260GL_R16I           GL_RED   │   i16    │            │           │            │        │
261       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
262GL_R16UI          GL_RED   │   ui16   │            │           │            │        │
263       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
264GL_R32I           GL_RED   │   i32    │            │           │            │        │
265       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
266GL_R32UI          GL_RED   │   ui32   │            │           │            │        │
267       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
268GL_RG8I           GL_RG    │    i8    │     i8     │           │            │        │
269       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
270GL_RG8UI          GL_RG    │   ui8    │    ui8     │           │            │        │
271       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
272GL_RG16I          GL_RG    │   i16    │    i16     │           │            │        │
273       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
274GL_RG16UI         GL_RG    │   ui16   │    ui16    │           │            │        │
275       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
276GL_RG32I          GL_RG    │   i32    │    i32     │           │            │        │
277       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
278GL_RG32UI         GL_RG    │   ui32   │    ui32    │           │            │        │
279       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
280GL_RGB8I          GL_RGB   │    i8    │     i8     │    i8     │            │        │
281       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
282GL_RGB8UI         GL_RGB   │   ui8    │    ui8     │    ui8    │            │        │
283       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
284GL_RGB16I         GL_RGB   │   i16    │    i16     │    i16    │            │        │
285       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
286GL_RGB16UI        GL_RGB   │   ui16   │    ui16    │   ui16    │            │        │
287       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
288GL_RGB32I         GL_RGB   │   i32    │    i32     │    i32    │            │        │
289       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
290GL_RGB32UI        GL_RGB   │   ui32   │    ui32    │   ui32    │            │        │
291       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
292GL_RGBA8I         GL_RGBA  │    i8    │     i8     │    i8     │     i8     │        │
293       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
294GL_RGBA8UI        GL_RGBA  │   ui8    │    ui8     │    ui8    │    ui8     │        │
295       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
296GL_RGBA16I        GL_RGBA  │   i16    │    i16     │    i16    │    i16     │        │
297       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
298GL_RGBA16UI       GL_RGBA  │   ui16   │    ui16    │   ui16    │    ui16    │        │
299       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
300GL_RGBA32I        GL_RGBA  │   i32    │    i32     │    i32    │    i32     │        │
301       ├──────────────────┼──────────┼──────────┼────────────┼───────────┼────────────┼────────┤
302GL_RGBA32UI       GL_RGBA  │   ui32   │    ui32    │   ui32    │    ui32    │        │
303       └──────────────────┴──────────┴──────────┴────────────┴───────────┴────────────┴────────┘
304
305       Finally, internalFormat may also be one of the generic or compressed
306       compressed texture formats shown in Table 3 below
307
308       Table 3. Compressed Internal Formats
309       ┌──────────────────────────────────────┬───────────────┬──────────┐
310Compressed Internal                   Base Internal Type     
311Format                                Format        │          │
312       ├──────────────────────────────────────┼───────────────┼──────────┤
313GL_COMPRESSED_RED                     GL_RED        │ Generic  │
314       ├──────────────────────────────────────┼───────────────┼──────────┤
315GL_COMPRESSED_RG                      GL_RG         │ Generic  │
316       ├──────────────────────────────────────┼───────────────┼──────────┤
317GL_COMPRESSED_RGB                     GL_RGB        │ Generic  │
318       ├──────────────────────────────────────┼───────────────┼──────────┤
319GL_COMPRESSED_RGBA                    GL_RGBA       │ Generic  │
320       ├──────────────────────────────────────┼───────────────┼──────────┤
321GL_COMPRESSED_SRGB                    GL_RGB        │ Generic  │
322       ├──────────────────────────────────────┼───────────────┼──────────┤
323GL_COMPRESSED_SRGB_ALPHA              GL_RGBA       │ Generic  │
324       ├──────────────────────────────────────┼───────────────┼──────────┤
325GL_COMPRESSED_RED_RGTC1               GL_RED        │ Specific │
326       ├──────────────────────────────────────┼───────────────┼──────────┤
327GL_COMPRESSED_SIGNED_RED_RGTC1        GL_RED        │ Specific │
328       ├──────────────────────────────────────┼───────────────┼──────────┤
329GL_COMPRESSED_RG_RGTC2                GL_RG         │ Specific │
330       ├──────────────────────────────────────┼───────────────┼──────────┤
331GL_COMPRESSED_SIGNED_RG_RGTC2         GL_RG         │ Specific │
332       ├──────────────────────────────────────┼───────────────┼──────────┤
333GL_COMPRESSED_RGBA_BPTC_UNORM         GL_RGBA       │ Specific │
334       ├──────────────────────────────────────┼───────────────┼──────────┤
335GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM   GL_RGBA       │ Specific │
336       ├──────────────────────────────────────┼───────────────┼──────────┤
337GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT   GL_RGB        │ Specific │
338       ├──────────────────────────────────────┼───────────────┼──────────┤
339GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT GL_RGB        │ Specific │
340       └──────────────────────────────────────┴───────────────┴──────────┘
341
342       If the internalFormat parameter is one of the generic compressed
343       formats, GL_COMPRESSED_RED, GL_COMPRESSED_RG, GL_COMPRESSED_RGB, or
344       GL_COMPRESSED_RGBA, the GL will replace the internal format with the
345       symbolic constant for a specific internal format and compress the
346       texture before storage. If no corresponding internal format is
347       available, or the GL can not compress that image for any reason, the
348       internal format is instead replaced with a corresponding base internal
349       format.
350
351       If the internalFormat parameter is GL_SRGB, GL_SRGB8, GL_SRGB_ALPHA, or
352       GL_SRGB8_ALPHA8, the texture is treated as if the red, green, or blue
353       components are encoded in the sRGB color space. Any alpha component is
354       left unchanged. The conversion from the sRGB encoded component c s to a
355       linear component c l is:
356
357       c l = { c s 12.92 if c s ≤ 0.04045 ( c s + 0.055 1.055 ) 2.4 if c s >
358       0.04045
359
360       Assume c s is the sRGB component in the range [0,1].
361
362       Use the GL_PROXY_TEXTURE_2D, GL_PROXY_TEXTURE_1D_ARRAY,
363       GL_PROXY_TEXTURE_RECTANGLE, or GL_PROXY_TEXTURE_CUBE_MAP target to try
364       out a resolution and format. The implementation will update and
365       recompute its best match for the requested storage resolution and
366       format. To then query this state, call glGetTexLevelParameter(). If the
367       texture cannot be accommodated, texture state is set to 0.
368
369       A one-component texture image uses only the red component of the RGBA
370       color extracted from data. A two-component image uses the R and G
371       values. A three-component image uses the R, G, and B values. A
372       four-component image uses all of the RGBA components.
373
374       Image-based shadowing can be enabled by comparing texture r coordinates
375       to depth texture values to generate a boolean result. See
376       glTexParameter() for details on texture comparison.
377

NOTES

379       The glPixelStore() mode affects texture images.
380
381       data may be a null pointer. In this case, texture memory is allocated
382       to accommodate a texture of width width and height height. You can then
383       download subtextures to initialize this texture memory. The image is
384       undefined if the user tries to apply an uninitialized portion of the
385       texture image to a primitive.
386
387       glTexImage2D specifies the two-dimensional texture for the current
388       texture unit, specified with glActiveTexture().
389
390       GL_STENCIL_INDEX may be used for format only if the GL version is 4.4
391       or higher.
392

ERRORS

394       GL_INVALID_ENUM is generated if target is not GL_TEXTURE_2D,
395       GL_TEXTURE_1D_ARRAY, GL_TEXTURE_RECTANGLE, GL_PROXY_TEXTURE_2D,
396       GL_PROXY_TEXTURE_1D_ARRAY, GL_PROXY_TEXTURE_RECTANGLE,
397       GL_PROXY_TEXTURE_CUBE_MAP, GL_TEXTURE_CUBE_MAP_POSITIVE_X,
398       GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
399       GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, or
400       GL_TEXTURE_CUBE_MAP_NEGATIVE_Z.
401
402       GL_INVALID_ENUM is generated if target is one of the six cube map 2D
403       image targets and the width and height parameters are not equal.
404
405       GL_INVALID_ENUM is generated if type is not a type constant.
406
407       GL_INVALID_VALUE is generated if width is less than 0 or greater than
408       GL_MAX_TEXTURE_SIZE.
409
410       GL_INVALID_VALUE is generated if target is not GL_TEXTURE_1D_ARRAY or
411       GL_PROXY_TEXTURE_1D_ARRAY and height is less than 0 or greater than
412       GL_MAX_TEXTURE_SIZE.
413
414       GL_INVALID_VALUE is generated if target is GL_TEXTURE_1D_ARRAY or
415       GL_PROXY_TEXTURE_1D_ARRAY and height is less than 0 or greater than
416       GL_MAX_ARRAY_TEXTURE_LAYERS.
417
418       GL_INVALID_VALUE is generated if level is less than 0.
419
420       GL_INVALID_VALUE may be generated if level is greater than log 2 ⁡ max,
421       where max is the returned value of GL_MAX_TEXTURE_SIZE.
422
423       GL_INVALID_VALUE is generated if internalFormat is not one of the
424       accepted resolution and format symbolic constants.
425
426       GL_INVALID_VALUE is generated if width or height is less than 0 or
427       greater than GL_MAX_TEXTURE_SIZE.
428
429       GL_INVALID_VALUE is generated if border is not 0.
430
431       GL_INVALID_OPERATION is generated if type is one of
432       GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
433       GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, or
434       GL_UNSIGNED_INT_10F_11F_11F_REV, and format is not GL_RGB.
435
436       GL_INVALID_OPERATION is generated if type is one of
437       GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
438       GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
439       GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV,
440       GL_UNSIGNED_INT_10_10_10_2, GL_UNSIGNED_INT_2_10_10_10_REV, or
441       GL_UNSIGNED_INT_5_9_9_9_REV, and format is neither GL_RGBA nor GL_BGRA.
442
443       GL_INVALID_OPERATION is generated if target is not GL_TEXTURE_2D,
444       GL_PROXY_TEXTURE_2D, GL_TEXTURE_RECTANGLE, or
445       GL_PROXY_TEXTURE_RECTANGLE, and internalFormat is GL_DEPTH_COMPONENT,
446       GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, or GL_DEPTH_COMPONENT32F.
447
448       GL_INVALID_OPERATION is generated if format is GL_DEPTH_COMPONENT and
449       internalFormat is not GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16,
450       GL_DEPTH_COMPONENT24, or GL_DEPTH_COMPONENT32F.
451
452       GL_INVALID_OPERATION is generated if internalFormat is
453       GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, or
454       GL_DEPTH_COMPONENT32F, and format is not GL_DEPTH_COMPONENT.
455
456       GL_INVALID_OPERATION is generated if a non-zero buffer object name is
457       bound to the GL_PIXEL_UNPACK_BUFFER target and the buffer object's data
458       store is currently mapped.
459
460       GL_INVALID_OPERATION is generated if a non-zero buffer object name is
461       bound to the GL_PIXEL_UNPACK_BUFFER target and the data would be
462       unpacked from the buffer object such that the memory reads required
463       would exceed the data store size.
464
465       GL_INVALID_OPERATION is generated if a non-zero buffer object name is
466       bound to the GL_PIXEL_UNPACK_BUFFER target and data is not evenly
467       divisible into the number of bytes needed to store in memory a datum
468       indicated by type.
469
470       GL_INVALID_VALUE is generated if target is GL_TEXTURE_RECTANGLE or
471       GL_PROXY_TEXTURE_RECTANGLE and level is not 0.
472

ASSOCIATED GETS

474       glGetTexImage()
475
476       glGet() with argument GL_PIXEL_UNPACK_BUFFER_BINDING
477

VERSION SUPPORT

479       ┌─────────────┬───────────────────────────────────────────────────────────────────────┐
480       │             │                OpenGL Version                                         
481       ├─────────────┼─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┤
482Function     2.0 2.1 3.0 3.1 3.2 3.3 4.0 4.1 4.2 4.3 4.4 4.5 
483/            │     │     │     │     │     │     │     │     │     │     │     │     │
484Feature      │     │     │     │     │     │     │     │     │     │     │     │     │
485Name         │     │     │     │     │     │     │     │     │     │     │     │     │
486       ├─────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
487glTexImage2D │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │
488       └─────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘
489

SEE ALSO

491       glActiveTexture(), glCopyTexImage1D(), glCopyTexImage2D(),
492       glCopyTexSubImage1D(), glCopyTexSubImage2D(), glCopyTexSubImage3D(),
493       glPixelStore(), glTexImage1D(), glTexImage3D(), glTexSubImage1D(),
494       glTexSubImage2D(), glTexSubImage3D(), glTexParameter()
495
497       Copyright © 1991-2006 Silicon Graphics, Inc. Copyright © 2011-2014
498       Khronos Group. This document is licensed under the SGI Free Software B
499       License. For details, see http://oss.sgi.com/projects/FreeB/.
500
502       Copyright © 1991-2006 Silicon Graphics, Inc.
503
504
505
506[FIXME: source]                   07/13/2018                  GLTEXIMAGE2D(3G)
Impressum