rename upstream-man-pages to upstream-doc
[clinton/guile-figl.git] / upstream-doc / man4 / glTexImage2D.xml
CommitLineData
7faf1d71
AW
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4<refentry id="glTexImage2D">
5 <refmeta>
6 <refmetainfo>
7 <copyright>
8 <year>1991-2006</year>
9 <holder>Silicon Graphics, Inc.</holder>
10 </copyright>
11 </refmetainfo>
12 <refentrytitle>glTexImage2D</refentrytitle>
13 <manvolnum>3G</manvolnum>
14 </refmeta>
15 <refnamediv>
16 <refname>glTexImage2D</refname>
17 <refpurpose>specify a two-dimensional texture image</refpurpose>
18 </refnamediv>
19 <refsynopsisdiv><title>C Specification</title>
20 <funcsynopsis>
21 <funcprototype>
22 <funcdef>void <function>glTexImage2D</function></funcdef>
23 <paramdef>GLenum <parameter>target</parameter></paramdef>
24 <paramdef>GLint <parameter>level</parameter></paramdef>
25 <paramdef>GLint <parameter>internalFormat</parameter></paramdef>
26 <paramdef>GLsizei <parameter>width</parameter></paramdef>
27 <paramdef>GLsizei <parameter>height</parameter></paramdef>
28 <paramdef>GLint <parameter>border</parameter></paramdef>
29 <paramdef>GLenum <parameter>format</parameter></paramdef>
30 <paramdef>GLenum <parameter>type</parameter></paramdef>
31 <paramdef>const GLvoid * <parameter>data</parameter></paramdef>
32 </funcprototype>
33 </funcsynopsis>
34 </refsynopsisdiv>
35 <!-- eqn: ignoring delim $$ -->
36 <para>
37 </para>
38 <refsect1 id="parameters"><title>Parameters</title>
39 <variablelist>
40 <varlistentry>
41 <term><parameter>target</parameter></term>
42 <listitem>
43 <para>
44 Specifies the target texture.
45 Must be <constant>GL_TEXTURE_2D</constant>, <constant>GL_PROXY_TEXTURE_2D</constant>,
46 <constant>GL_TEXTURE_1D_ARRAY</constant>, <constant>GL_PROXY_TEXTURE_1D_ARRAY</constant>,
47 <constant>GL_TEXTURE_RECTANGLE</constant>, <constant>GL_PROXY_TEXTURE_RECTANGLE</constant>,
48 <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_X</constant>,
49 <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_X</constant>,
50 <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_Y</constant>,
51 <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_Y</constant>,
52 <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_Z</constant>,
53 <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_Z</constant>, or
54 <constant>GL_PROXY_TEXTURE_CUBE_MAP</constant>.
55 </para>
56 </listitem>
57 </varlistentry>
58 <varlistentry>
59 <term><parameter>level</parameter></term>
60 <listitem>
61 <para>
62 Specifies the level-of-detail number.
63 Level 0 is the base image level.
64 Level <emphasis>n</emphasis> is the <emphasis>n</emphasis>th mipmap reduction image.
65 If <parameter>target</parameter> is <constant>GL_TEXTURE_RECTANGLE</constant> or
66 <constant>GL_PROXY_TEXTURE_RECTANGLE</constant>, <parameter>level</parameter> must be 0.
67 </para>
68 </listitem>
69 </varlistentry>
70 <varlistentry>
71 <term><parameter>internalFormat</parameter></term>
72 <listitem>
73 <para>
74 Specifies the number of color components in the texture.
75 Must be one of base internal formats given in Table 1,
76 one of the sized internal formats given in Table 2, or one
77 of the compressed internal formats given in Table 3, below.
78 </para>
79 </listitem>
80 </varlistentry>
81 <varlistentry>
82 <term><parameter>width</parameter></term>
83 <listitem>
84 <para>
85 Specifies the width of the texture image.
86 All implementations support texture images that are at least 1024 texels
87 wide.
88 </para>
89 </listitem>
90 </varlistentry>
91 <varlistentry>
92 <term><parameter>height</parameter></term>
93 <listitem>
94 <para>
95 Specifies the height of the texture image, or the number of layers in a texture
96 array, in the case of the <constant>GL_TEXTURE_1D_ARRAY</constant> and
97 <constant>GL_PROXY_TEXTURE_1D_ARRAY</constant> targets.
98 All implementations support 2D texture images that are at least 1024 texels
99 high, and texture arrays that are at least 256 layers deep.
100 </para>
101 </listitem>
102 </varlistentry>
103 <varlistentry>
104 <term><parameter>border</parameter></term>
105 <listitem>
106 <para>
107 This value must be 0.
108 </para>
109 </listitem>
110 </varlistentry>
111 <varlistentry>
112 <term><parameter>format</parameter></term>
113 <listitem>
114 <para>
115 Specifies the format of the pixel data.
116 The following symbolic values are accepted:
117 <constant>GL_RED</constant>,
118 <constant>GL_RG</constant>,
119 <constant>GL_RGB</constant>,
120 <constant>GL_BGR</constant>,
121 <constant>GL_RGBA</constant>, and
122 <constant>GL_BGRA</constant>.
123 </para>
124 </listitem>
125 </varlistentry>
126 <varlistentry>
127 <term><parameter>type</parameter></term>
128 <listitem>
129 <para>
130 Specifies the data type of the pixel data.
131 The following symbolic values are accepted:
132 <constant>GL_UNSIGNED_BYTE</constant>,
133 <constant>GL_BYTE</constant>,
134 <constant>GL_UNSIGNED_SHORT</constant>,
135 <constant>GL_SHORT</constant>,
136 <constant>GL_UNSIGNED_INT</constant>,
137 <constant>GL_INT</constant>,
138 <constant>GL_FLOAT</constant>,
139 <constant>GL_UNSIGNED_BYTE_3_3_2</constant>,
140 <constant>GL_UNSIGNED_BYTE_2_3_3_REV</constant>,
141 <constant>GL_UNSIGNED_SHORT_5_6_5</constant>,
142 <constant>GL_UNSIGNED_SHORT_5_6_5_REV</constant>,
143 <constant>GL_UNSIGNED_SHORT_4_4_4_4</constant>,
144 <constant>GL_UNSIGNED_SHORT_4_4_4_4_REV</constant>,
145 <constant>GL_UNSIGNED_SHORT_5_5_5_1</constant>,
146 <constant>GL_UNSIGNED_SHORT_1_5_5_5_REV</constant>,
147 <constant>GL_UNSIGNED_INT_8_8_8_8</constant>,
148 <constant>GL_UNSIGNED_INT_8_8_8_8_REV</constant>,
149 <constant>GL_UNSIGNED_INT_10_10_10_2</constant>, and
150 <constant>GL_UNSIGNED_INT_2_10_10_10_REV</constant>.
151 </para>
152 </listitem>
153 </varlistentry>
154 <varlistentry>
155 <term><parameter>data</parameter></term>
156 <listitem>
157 <para>
158 Specifies a pointer to the image data in memory.
159 </para>
160 </listitem>
161 </varlistentry>
162 </variablelist>
163 </refsect1>
164 <refsect1 id="description"><title>Description</title>
165 <para>
166 Texturing allows elements of an image array to be read by shaders.
167 </para>
168 <para>
169 To define texture images, call <function>glTexImage2D</function>.
170 The arguments describe the parameters of the texture image,
171 such as height, width, width of the border, level-of-detail number
172 (see <citerefentry><refentrytitle>glTexParameter</refentrytitle></citerefentry>),
173 and number of color components provided.
174 The last three arguments describe how the image is represented in memory.
175 </para>
176 <para>
177 If <parameter>target</parameter> is <constant>GL_PROXY_TEXTURE_2D</constant>, <constant>GL_PROXY_TEXTURE_1D_ARRAY</constant>,
178 <constant>GL_PROXY_TEXTURE_CUBE_MAP</constant>, or <constant>GL_PROXY_TEXTURE_RECTANGLE</constant>,
179 no data is read from <parameter>data</parameter>, but
180 all of the texture image state is recalculated, checked for
181 consistency, and checked
182 against the implementation's capabilities. If the implementation cannot
183 handle a texture of the requested texture size, it sets
184 all of the image state to 0,
185 but does not generate an error (see <citerefentry><refentrytitle>glGetError</refentrytitle></citerefentry>). To query for an
186 entire mipmap array, use an image array level greater than or equal to 1.
187 </para>
188 <para>
189 If <parameter>target</parameter> is <constant>GL_TEXTURE_2D</constant>, <constant>GL_TEXTURE_RECTANGLE</constant>
190 or one of the <constant>GL_TEXTURE_CUBE_MAP</constant>
191 targets, data is read from <parameter>data</parameter> as a sequence of signed or unsigned
192 bytes, shorts, or longs, or single-precision floating-point values,
193 depending on <parameter>type</parameter>. These values are grouped into sets of one, two,
194 three, or four values, depending on <parameter>format</parameter>, to form elements.
195 Each data byte is treated as eight 1-bit elements,
196 with bit ordering determined by <constant>GL_UNPACK_LSB_FIRST</constant>
197 (see <citerefentry><refentrytitle>glPixelStore</refentrytitle></citerefentry>).
198 </para>
199 <para>
200 If <parameter>target</parameter> is <constant>GL_TEXTURE_1D_ARRAY</constant>, data is interpreted
201 as an array of one-dimensional images.
202 </para>
203 <para>
204 If a non-zero named buffer object is bound to the <constant>GL_PIXEL_UNPACK_BUFFER</constant> target
205 (see <citerefentry><refentrytitle>glBindBuffer</refentrytitle></citerefentry>) while a texture image is
206 specified, <parameter>data</parameter> is treated as a byte offset into the buffer object's data store.
207 </para>
208 <para>
209 The first element corresponds to the lower left corner of the texture image.
210 Subsequent elements progress left-to-right through the remaining texels
211 in the lowest row of the texture image, and then in successively higher
212 rows of the texture image.
213 The final element corresponds to the upper right corner of the texture
214 image.
215 </para>
216 <para>
217 <parameter>format</parameter> determines the composition of each element in <parameter>data</parameter>.
218 It can assume one of these symbolic values:
219 </para>
220 <variablelist>
221 <varlistentry>
222 <term><constant>GL_RED</constant></term>
223 <listitem>
224 <para>
225 Each element is a single red component.
226 The GL converts it to floating point and assembles it into an RGBA element
227 by attaching 0 for green and blue, and 1 for alpha.
228 Each component is then multiplied by the signed scale factor <constant>GL_c_SCALE</constant>,
229 added to the signed bias <constant>GL_c_BIAS</constant>,
230 and clamped to the range [0,1].
231 </para>
232 </listitem>
233 </varlistentry>
234 <varlistentry>
235 <term><constant>GL_RG</constant></term>
236 <listitem>
237 <para>
238 Each element is a red/green double.
239 The GL converts it to floating point and assembles it into an RGBA element
240 by attaching 0 for blue, and 1 for alpha.
241 Each component is then multiplied by the signed scale factor <constant>GL_c_SCALE</constant>,
242 added to the signed bias <constant>GL_c_BIAS</constant>,
243 and clamped to the range [0,1].
244 </para>
245 </listitem>
246 </varlistentry>
247 <varlistentry>
248 <term><constant>GL_RGB</constant></term>
249 <listitem>
250 </listitem>
251 </varlistentry>
252 <varlistentry>
253 <term><constant>GL_BGR</constant></term>
254 <listitem>
255 <para>
256 Each element is an RGB triple.
257 The GL converts it to floating point and assembles it into an RGBA element
258 by attaching 1 for alpha.
259 Each component is then multiplied by the signed scale factor <constant>GL_c_SCALE</constant>,
260 added to the signed bias <constant>GL_c_BIAS</constant>,
261 and clamped to the range [0,1].
262 </para>
263 </listitem>
264 </varlistentry>
265 <varlistentry>
266 <term><constant>GL_RGBA</constant></term>
267 <listitem>
268 </listitem>
269 </varlistentry>
270 <varlistentry>
271 <term><constant>GL_BGRA</constant></term>
272 <listitem>
273 <para>
274 Each element contains all four components.
275 Each component is multiplied by the signed scale factor <constant>GL_c_SCALE</constant>,
276 added to the signed bias <constant>GL_c_BIAS</constant>,
277 and clamped to the range [0,1].
278 </para>
279 </listitem>
280 </varlistentry>
281 <varlistentry>
282 <term><constant>GL_DEPTH_COMPONENT</constant></term>
283 <listitem>
284 <para>
285 Each element is a single depth value.
286 The GL converts it to floating point, multiplies by the signed scale factor
287 <constant>GL_DEPTH_SCALE</constant>, adds the signed bias <constant>GL_DEPTH_BIAS</constant>,
288 and clamps to the range [0,1].
289 </para>
290 </listitem>
291 </varlistentry>
292 <varlistentry>
293 <term><constant>GL_DEPTH_STENCIL</constant></term>
294 <listitem>
295 <para>
296 Each element is a pair of depth and stencil values. The depth component of
297 the pair is interpreted as in <constant>GL_DEPTH_COMPONENT</constant>. The stencil
298 component is interpreted based on specified the depth + stencil internal format.
299 </para>
300 </listitem>
301 </varlistentry>
302 </variablelist>
303 <para>
304 If an application wants to store the texture at a certain
305 resolution or in a certain format, it can request the resolution
306 and format with <parameter>internalFormat</parameter>. The GL will choose an internal
307 representation that closely approximates that requested by <parameter>internalFormat</parameter>, but
308 it may not match exactly.
309 (The representations specified by <constant>GL_RED</constant>,
310 <constant>GL_RG</constant>, <constant>GL_RGB</constant>,
311 and <constant>GL_RGBA</constant> must match exactly.)
312 </para>
313 <para>
314 <parameter>internalFormat</parameter> may be one of the base internal formats shown in
315 Table 1, below
316 </para>
317 <para>
318 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="baseformattable.xml" />
319 </para>
320 <para>
321 <parameter>internalFormat</parameter> may also be one of the sized internal formats
322 shown in Table 2, below
323 </para>
324 <para>
325 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="internalformattable.xml" />
326 </para>
327 <para>
328 Finally, <parameter>internalFormat</parameter> may also be one of the generic or compressed
329 compressed texture formats shown in Table 3 below
330 </para>
331 <para>
332 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="compressedformattable.xml" />
333 </para>
334 <para>
335 If the <parameter>internalFormat</parameter> parameter is one of the generic compressed formats,
336 <constant>GL_COMPRESSED_RED</constant>, <constant>GL_COMPRESSED_RG</constant>,
337 <constant>GL_COMPRESSED_RGB</constant>, or
338 <constant>GL_COMPRESSED_RGBA</constant>, the GL will replace the internal format with the symbolic constant for a specific internal format and compress the texture before storage. If no corresponding internal format is available, or the GL can not compress that image for any reason, the internal format is instead replaced with a corresponding base internal format.
339 </para>
340 <para>
341 If the <parameter>internalFormat</parameter> parameter is
342 <constant>GL_SRGB</constant>,
343 <constant>GL_SRGB8</constant>,
344 <constant>GL_SRGB_ALPHA</constant>, or
345 <constant>GL_SRGB8_ALPHA8</constant>, the texture is treated as if the red, green, or blue components are encoded in the sRGB color space. Any alpha component is left unchanged. The conversion from the sRGB encoded component
346 <inlineequation><mml:math>
347 <mml:msub><mml:mi mathvariant="italic">c</mml:mi>
348 <mml:mi mathvariant="italic">s</mml:mi>
349 </mml:msub>
350 </mml:math></inlineequation>
351 to a linear component
352 <inlineequation><mml:math>
353 <mml:msub><mml:mi mathvariant="italic">c</mml:mi>
354 <mml:mi mathvariant="italic">l</mml:mi>
355 </mml:msub>
356 </mml:math></inlineequation>
357 is:
358 </para>
359 <para>
360 <inlineequation><mml:math>
361 <mml:mrow>
362 <mml:msub>
363 <mml:mi mathvariant="italic">c</mml:mi>
364 <mml:mi mathvariant="italic">l</mml:mi>
365 </mml:msub>
366 <mml:mo>=</mml:mo>
367 <mml:mrow>
368 <mml:mo>{</mml:mo>
369
370 <mml:mtable columnalign="left">
371 <mml:mtr>
372 <mml:mtd columnalign="left">
373 <mml:mfrac>
374 <mml:msub>
375 <mml:mi mathvariant="italic">c</mml:mi>
376 <mml:mi mathvariant="italic">s</mml:mi>
377 </mml:msub>
378 <mml:mn>12.92</mml:mn>
379 </mml:mfrac>
380 </mml:mtd>
381 <mml:mtd columnalign="left">
382 <mml:mrow>
383 <mml:mspace width="1ex"/>
384 <mml:mo>if</mml:mo>
385 <mml:mspace width="1ex"/>
386 </mml:mrow>
387 <mml:msub>
388 <mml:mi mathvariant="italic">c</mml:mi>
389 <mml:mi mathvariant="italic">s</mml:mi>
390 </mml:msub>
391 <mml:mo>&le;</mml:mo>
392 <mml:mn>0.04045</mml:mn>
393 </mml:mtd>
394 </mml:mtr>
395 <mml:mtr>
396 <mml:mtd columnalign="left">
397 <mml:msup>
398 <mml:mrow>
399 <mml:mo>(</mml:mo>
400 <mml:mfrac>
401 <mml:mrow>
402 <mml:msub>
403 <mml:mi>c</mml:mi>
404 <mml:mi>s</mml:mi>
405 </mml:msub>
406 <mml:mo>+</mml:mo>
407 <mml:mn>0.055</mml:mn>
408 </mml:mrow>
409 <mml:mn>1.055</mml:mn>
410 </mml:mfrac>
411 <mml:mo>)</mml:mo>
412 </mml:mrow>
413 <mml:mn>2.4</mml:mn>
414 </mml:msup>
415 </mml:mtd>
416 <mml:mtd columnalign="left">
417 <mml:mrow>
418 <mml:mspace width="1ex"/>
419 <mml:mo>if</mml:mo>
420 <mml:mspace width="1ex"/>
421 </mml:mrow>
422 <mml:msub>
423 <mml:mi mathvariant="italic">c</mml:mi>
424 <mml:mi mathvariant="italic">s</mml:mi>
425 </mml:msub>
426 <mml:mo>&gt;</mml:mo>
427 <mml:mn>0.04045</mml:mn>
428 </mml:mtd>
429 </mml:mtr>
430 </mml:mtable>
431 </mml:mrow>
432 </mml:mrow>
433 </mml:math>
434 </inlineequation>
435 </para>
436 <para>
437 Assume
438 <inlineequation><mml:math>
439 <mml:msub><mml:mi mathvariant="italic">c</mml:mi>
440 <mml:mi mathvariant="italic">s</mml:mi>
441 </mml:msub>
442 </mml:math></inlineequation>
443 is the sRGB component in the range [0,1].
444 </para>
445 <para>
446 Use the <constant>GL_PROXY_TEXTURE_2D</constant>, <constant>GL_PROXY_TEXTURE_1D_ARRAY</constant>,
447 <constant>GL_PROXY_TEXTURE_RECTANGLE</constant>, or <constant>GL_PROXY_TEXTURE_CUBE_MAP</constant> target to try out a resolution and
448 format. The implementation will
449 update and recompute its best match for the requested storage resolution
450 and format. To then query this state, call <citerefentry><refentrytitle>glGetTexLevelParameter</refentrytitle></citerefentry>.
451 If the texture cannot be accommodated, texture state is set to 0.
452 </para>
453 <para>
454 A one-component texture image uses only the red component of the RGBA
455 color extracted from <parameter>data</parameter>.
456 A two-component image uses the R and G values.
457 A three-component image uses the R, G, and B values.
458 A four-component image uses all of the RGBA components.
459 </para>
460 <para>
461 Image-based shadowing can be enabled by comparing texture r coordinates to
462 depth texture values to generate a boolean result.
463 See <citerefentry><refentrytitle>glTexParameter</refentrytitle></citerefentry> for details on texture comparison.
464 </para>
465 </refsect1>
466 <refsect1 id="notes"><title>Notes</title>
467 <para>
468 The <citerefentry><refentrytitle>glPixelStore</refentrytitle></citerefentry> mode affects texture images.
469 </para>
470 <para>
471 <parameter>data</parameter> may be a null pointer.
472 In this case, texture memory is
473 allocated to accommodate a texture of width <parameter>width</parameter> and height <parameter>height</parameter>.
474 You can then download subtextures to initialize this
475 texture memory.
476 The image is undefined if the user tries to apply
477 an uninitialized portion of the texture image to a primitive.
478 </para>
479 <para>
480 <function>glTexImage2D</function> specifies the two-dimensional texture for the current texture unit,
481 specified with <citerefentry><refentrytitle>glActiveTexture</refentrytitle></citerefentry>.
482 </para>
483 </refsect1>
484 <refsect1 id="errors"><title>Errors</title>
485 <para>
486 <constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is not
487 <constant>GL_TEXTURE_2D</constant>,
488 <constant>GL_TEXTURE_1D_ARRAY</constant>,
489 <constant>GL_TEXTURE_RECTANGLE</constant>,
490 <constant>GL_PROXY_TEXTURE_2D</constant>,
491 <constant>GL_PROXY_TEXTURE_1D_ARRAY</constant>,
492 <constant>GL_PROXY_TEXTURE_RECTANGLE</constant>,
493 <constant>GL_PROXY_TEXTURE_CUBE_MAP</constant>,
494 <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_X</constant>,
495 <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_X</constant>,
496 <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_Y</constant>,
497 <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_Y</constant>,
498 <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_Z</constant>, or
499 <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_Z</constant>.
500 </para>
501 <para>
502 <constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is one of the six cube map 2D image targets and the width and height parameters are not equal.
503 </para>
504 <para>
505 <constant>GL_INVALID_ENUM</constant> is generated if <parameter>type</parameter> is not a type constant.
506 </para>
507 <para>
508 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>width</parameter> is less than 0
509 or greater than <constant>GL_MAX_TEXTURE_SIZE</constant>.
510 </para>
511 <para>
512 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>target</parameter> is not <constant>GL_TEXTURE_1D_ARRAY</constant> or
513 <constant>GL_PROXY_TEXTURE_1D_ARRAY</constant> and <parameter>height</parameter> is less than 0 or greater than <constant>GL_MAX_TEXTURE_SIZE</constant>.
514 </para>
515 <para>
516 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>target</parameter> is <constant>GL_TEXTURE_1D_ARRAY</constant> or
517 <constant>GL_PROXY_TEXTURE_1D_ARRAY</constant> and <parameter>height</parameter> is less than 0 or greater than <constant>GL_MAX_ARRAY_TEXTURE_LAYERS</constant>.
518 </para>
519 <para>
520 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>level</parameter> is less than 0.
521 </para>
522 <para>
523 <constant>GL_INVALID_VALUE</constant> may be generated if <parameter>level</parameter> is greater than
524 <inlineequation><mml:math>
525 <!-- eqn: log sub 2 (max): -->
526 <mml:mrow>
527 <mml:msub><mml:mi mathvariant="italic">log</mml:mi>
528 <mml:mn>2</mml:mn>
529 </mml:msub>
530 <mml:mo>&af;</mml:mo>
531 <mml:mfenced open="(" close=")">
532 <mml:mi mathvariant="italic">max</mml:mi>
533 </mml:mfenced>
534 </mml:mrow>
535 </mml:math></inlineequation>,
536 where <emphasis>max</emphasis> is the returned value of <constant>GL_MAX_TEXTURE_SIZE</constant>.
537 </para>
538 <para>
539 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>internalFormat</parameter> is not one of the
540 accepted resolution and format symbolic constants.
541 </para>
542 <para>
543 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>width</parameter> or <parameter>height</parameter> is less than 0
544 or greater than <constant>GL_MAX_TEXTURE_SIZE</constant>.
545 </para>
546 <para>
547 <constant>GL_INVALID_VALUE</constant> is generated if non-power-of-two textures are not supported and the <parameter>width</parameter> or <parameter>height</parameter> cannot be represented as
548 <inlineequation><mml:math>
549 <!-- eqn: 2 sup k + 2(border): -->
550 <mml:mrow>
551 <mml:msup><mml:mn>2</mml:mn>
552 <mml:mi mathvariant="italic">k</mml:mi>
553 </mml:msup>
554 <mml:mo>+</mml:mo>
555 <mml:mrow>
556 <mml:mn>2</mml:mn>
557 <mml:mo>&af;</mml:mo>
558 <mml:mfenced open="(" close=")">
559 <mml:mi mathvariant="italic">border</mml:mi>
560 </mml:mfenced>
561 </mml:mrow>
562 </mml:mrow>
563 </mml:math></inlineequation>
564 for some
565 integer value of <emphasis>k</emphasis>.
566 </para>
567 <para>
568 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>border</parameter> is not 0.
569 </para>
570 <para>
571 <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>type</parameter> is one of
572 <constant>GL_UNSIGNED_BYTE_3_3_2</constant>,
573 <constant>GL_UNSIGNED_BYTE_2_3_3_REV</constant>,
574 <constant>GL_UNSIGNED_SHORT_5_6_5</constant>,
575 <constant>GL_UNSIGNED_SHORT_5_6_5_REV</constant>, or
576 <constant>GL_UNSIGNED_INT_10F_11F_11F_REV</constant>,
577 and <parameter>format</parameter> is not <constant>GL_RGB</constant>.
578 </para>
579 <para>
580 <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>type</parameter> is one of
581 <constant>GL_UNSIGNED_SHORT_4_4_4_4</constant>,
582 <constant>GL_UNSIGNED_SHORT_4_4_4_4_REV</constant>,
583 <constant>GL_UNSIGNED_SHORT_5_5_5_1</constant>,
584 <constant>GL_UNSIGNED_SHORT_1_5_5_5_REV</constant>,
585 <constant>GL_UNSIGNED_INT_8_8_8_8</constant>,
586 <constant>GL_UNSIGNED_INT_8_8_8_8_REV</constant>,
587 <constant>GL_UNSIGNED_INT_10_10_10_2</constant>,
588 <constant>GL_UNSIGNED_INT_2_10_10_10_REV</constant>, or
589 <constant>GL_UNSIGNED_INT_5_9_9_9_REV</constant>,
590 and <parameter>format</parameter> is neither <constant>GL_RGBA</constant> nor <constant>GL_BGRA</constant>.
591 </para>
592 <para>
593 <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>target</parameter> is not
594 <constant>GL_TEXTURE_2D</constant>, <constant>GL_PROXY_TEXTURE_2D</constant>,
595 <constant>GL_TEXTURE_RECTANGLE</constant>, or <constant>GL_PROXY_TEXTURE_RECTANGLE</constant>,
596 and <parameter>internalFormat</parameter> is
597 <constant>GL_DEPTH_COMPONENT</constant>, <constant>GL_DEPTH_COMPONENT16</constant>,
598 <constant>GL_DEPTH_COMPONENT24</constant>, or <constant>GL_DEPTH_COMPONENT32F</constant>.
599 </para>
600 <para>
601 <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>format</parameter> is
602 <constant>GL_DEPTH_COMPONENT</constant> and <parameter>internalFormat</parameter> is not
603 <constant>GL_DEPTH_COMPONENT</constant>, <constant>GL_DEPTH_COMPONENT16</constant>,
604 <constant>GL_DEPTH_COMPONENT24</constant>, or <constant>GL_DEPTH_COMPONENT32F</constant>.
605 </para>
606 <para>
607 <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>internalFormat</parameter> is
608 <constant>GL_DEPTH_COMPONENT</constant>, <constant>GL_DEPTH_COMPONENT16</constant>,
609 <constant>GL_DEPTH_COMPONENT24</constant>, or <constant>GL_DEPTH_COMPONENT32F</constant>, and <parameter>format</parameter> is
610 not <constant>GL_DEPTH_COMPONENT</constant>.
611 </para>
612 <para>
613 <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to the
614 <constant>GL_PIXEL_UNPACK_BUFFER</constant> target and the buffer object's data store is currently mapped.
615 </para>
616 <para>
617 <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to the
618 <constant>GL_PIXEL_UNPACK_BUFFER</constant> target and the data would be unpacked from the buffer
619 object such that the memory reads required would exceed the data store size.
620 </para>
621 <para>
622 <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to the
623 <constant>GL_PIXEL_UNPACK_BUFFER</constant> target and <parameter>data</parameter> is not evenly divisible
624 into the number of bytes needed to store in memory a datum indicated by <parameter>type</parameter>.
625 </para>
626 <para>
627 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>target</parameter> is <constant>GL_TEXTURE_RECTANGLE</constant>
628 or <constant>GL_PROXY_TEXTURE_RECTANGLE</constant> and <parameter>level</parameter> is not 0.
629 </para>
630 </refsect1>
631 <refsect1 id="associatedgets"><title>Associated Gets</title>
632 <para>
633 <citerefentry><refentrytitle>glGetTexImage</refentrytitle></citerefentry>
634 </para>
635 <para>
636 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_PIXEL_UNPACK_BUFFER_BINDING</constant>
637 </para>
638 </refsect1>
639 <refsect1 id="seealso"><title>See Also</title>
640 <para>
641 <citerefentry><refentrytitle>glActiveTexture</refentrytitle></citerefentry>,
642 <citerefentry><refentrytitle>glCopyTexImage1D</refentrytitle></citerefentry>,
643 <citerefentry><refentrytitle>glCopyTexImage2D</refentrytitle></citerefentry>,
644 <citerefentry><refentrytitle>glCopyTexSubImage1D</refentrytitle></citerefentry>,
645 <citerefentry><refentrytitle>glCopyTexSubImage2D</refentrytitle></citerefentry>,
646 <citerefentry><refentrytitle>glCopyTexSubImage3D</refentrytitle></citerefentry>,
647 <citerefentry><refentrytitle>glPixelStore</refentrytitle></citerefentry>,
648 <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>,
649 <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry>,
650 <citerefentry><refentrytitle>glTexSubImage1D</refentrytitle></citerefentry>,
651 <citerefentry><refentrytitle>glTexSubImage2D</refentrytitle></citerefentry>,
652 <citerefentry><refentrytitle>glTexSubImage3D</refentrytitle></citerefentry>,
653 <citerefentry><refentrytitle>glTexParameter</refentrytitle></citerefentry>
654 </para>
655 </refsect1>
656 <refsect1 id="Copyright"><title>Copyright</title>
657 <para>
658 Copyright <trademark class="copyright"></trademark> 1991-2006 Silicon Graphics, Inc.
659 Copyright <trademark class="copyright"></trademark> 2011 Khronos Group.
660 This document is licensed under the SGI
661 Free Software B License. For details, see
662 <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>.
663 </para>
664 </refsect1>
665</refentry>