rename upstream-man-pages to upstream-doc
[clinton/guile-figl.git] / upstream-doc / man3 / 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 If the <parameter>internalFormat</parameter> parameter is one of the generic compressed formats,
315 <constant>GL_COMPRESSED_RED</constant>, <constant>GL_COMPRESSED_RG</constant>,
316 <constant>GL_COMPRESSED_RGB</constant>, or
317 <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.
318 </para>
319 <para>
320 If the <parameter>internalFormat</parameter> parameter is
321 <constant>GL_SRGB</constant>,
322 <constant>GL_SRGB8</constant>,
323 <constant>GL_SRGB_ALPHA</constant>, or
324 <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
325 <inlineequation><mml:math>
326 <mml:msub><mml:mi mathvariant="italic">c</mml:mi>
327 <mml:mi mathvariant="italic">s</mml:mi>
328 </mml:msub>
329 </mml:math></inlineequation>
330 to a linear component
331 <inlineequation><mml:math>
332 <mml:msub><mml:mi mathvariant="italic">c</mml:mi>
333 <mml:mi mathvariant="italic">l</mml:mi>
334 </mml:msub>
335 </mml:math></inlineequation>
336 is:
337 </para>
338 <para>
339 <inlineequation><mml:math>
340 <mml:mrow>
341 <mml:msub>
342 <mml:mi mathvariant="italic">c</mml:mi>
343 <mml:mi mathvariant="italic">l</mml:mi>
344 </mml:msub>
345 <mml:mo>=</mml:mo>
346 <mml:mrow>
347 <mml:mo>{</mml:mo>
348
349 <mml:mtable columnalign="left">
350 <mml:mtr>
351 <mml:mtd columnalign="left">
352 <mml:mfrac>
353 <mml:msub>
354 <mml:mi mathvariant="italic">c</mml:mi>
355 <mml:mi mathvariant="italic">s</mml:mi>
356 </mml:msub>
357 <mml:mn>12.92</mml:mn>
358 </mml:mfrac>
359 </mml:mtd>
360 <mml:mtd columnalign="left">
361 <mml:mrow>
362 <mml:mspace width="1ex"/>
363 <mml:mo>if</mml:mo>
364 <mml:mspace width="1ex"/>
365 </mml:mrow>
366 <mml:msub>
367 <mml:mi mathvariant="italic">c</mml:mi>
368 <mml:mi mathvariant="italic">s</mml:mi>
369 </mml:msub>
370 <mml:mo>&le;</mml:mo>
371 <mml:mn>0.04045</mml:mn>
372 </mml:mtd>
373 </mml:mtr>
374 <mml:mtr>
375 <mml:mtd columnalign="left">
376 <mml:msup>
377 <mml:mrow>
378 <mml:mo>(</mml:mo>
379 <mml:mfrac>
380 <mml:mrow>
381 <mml:msub>
382 <mml:mi>c</mml:mi>
383 <mml:mi>s</mml:mi>
384 </mml:msub>
385 <mml:mo>+</mml:mo>
386 <mml:mn>0.055</mml:mn>
387 </mml:mrow>
388 <mml:mn>1.055</mml:mn>
389 </mml:mfrac>
390 <mml:mo>)</mml:mo>
391 </mml:mrow>
392 <mml:mn>2.4</mml:mn>
393 </mml:msup>
394 </mml:mtd>
395 <mml:mtd columnalign="left">
396 <mml:mrow>
397 <mml:mspace width="1ex"/>
398 <mml:mo>if</mml:mo>
399 <mml:mspace width="1ex"/>
400 </mml:mrow>
401 <mml:msub>
402 <mml:mi mathvariant="italic">c</mml:mi>
403 <mml:mi mathvariant="italic">s</mml:mi>
404 </mml:msub>
405 <mml:mo>&gt;</mml:mo>
406 <mml:mn>0.04045</mml:mn>
407 </mml:mtd>
408 </mml:mtr>
409 </mml:mtable>
410 </mml:mrow>
411 </mml:mrow>
412 </mml:math>
413 </inlineequation>
414 </para>
415 <para>
416 Assume
417 <inlineequation><mml:math>
418 <mml:msub><mml:mi mathvariant="italic">c</mml:mi>
419 <mml:mi mathvariant="italic">s</mml:mi>
420 </mml:msub>
421 </mml:math></inlineequation>
422 is the sRGB component in the range [0,1].
423 </para>
424 <para>
425 Use the <constant>GL_PROXY_TEXTURE_2D</constant>, <constant>GL_PROXY_TEXTURE_1D_ARRAY</constant>,
426 <constant>GL_PROXY_TEXTURE_RECTANGLE</constant>, or <constant>GL_PROXY_TEXTURE_CUBE_MAP</constant> target to try out a resolution and
427 format. The implementation will
428 update and recompute its best match for the requested storage resolution
429 and format. To then query this state, call <citerefentry><refentrytitle>glGetTexLevelParameter</refentrytitle></citerefentry>.
430 If the texture cannot be accommodated, texture state is set to 0.
431 </para>
432 <para>
433 A one-component texture image uses only the red component of the RGBA
434 color extracted from <parameter>data</parameter>.
435 A two-component image uses the R and G values.
436 A three-component image uses the R, G, and B values.
437 A four-component image uses all of the RGBA components.
438 </para>
439 <para>
440 Image-based shadowing can be enabled by comparing texture r coordinates to
441 depth texture values to generate a boolean result.
442 See <citerefentry><refentrytitle>glTexParameter</refentrytitle></citerefentry> for details on texture comparison.
443 </para>
444 </refsect1>
445 <refsect1 id="notes"><title>Notes</title>
446 <para>
447 The <citerefentry><refentrytitle>glPixelStore</refentrytitle></citerefentry> mode affects texture images.
448 </para>
449 <para>
450 <parameter>data</parameter> may be a null pointer.
451 In this case, texture memory is
452 allocated to accommodate a texture of width <parameter>width</parameter> and height <parameter>height</parameter>.
453 You can then download subtextures to initialize this
454 texture memory.
455 The image is undefined if the user tries to apply
456 an uninitialized portion of the texture image to a primitive.
457 </para>
458 <para>
459 <function>glTexImage2D</function> specifies the two-dimensional texture for the current texture unit,
460 specified with <citerefentry><refentrytitle>glActiveTexture</refentrytitle></citerefentry>.
461 </para>
462 </refsect1>
463 <refsect1 id="errors"><title>Errors</title>
464 <para>
465 <constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is not
466 <constant>GL_TEXTURE_2D</constant>,
467 <constant>GL_TEXTURE_1D_ARRAY</constant>,
468 <constant>GL_TEXTURE_RECTANGLE</constant>,
469 <constant>GL_PROXY_TEXTURE_2D</constant>,
470 <constant>GL_PROXY_TEXTURE_1D_ARRAY</constant>,
471 <constant>GL_PROXY_TEXTURE_RECTANGLE</constant>,
472 <constant>GL_PROXY_TEXTURE_CUBE_MAP</constant>,
473 <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_X</constant>,
474 <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_X</constant>,
475 <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_Y</constant>,
476 <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_Y</constant>,
477 <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_Z</constant>, or
478 <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_Z</constant>.
479 </para>
480 <para>
481 <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.
482 </para>
483 <para>
484 <constant>GL_INVALID_ENUM</constant> is generated if <parameter>type</parameter> is not a type constant.
485 </para>
486 <para>
487 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>width</parameter> is less than 0
488 or greater than <constant>GL_MAX_TEXTURE_SIZE</constant>.
489 </para>
490 <para>
491 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>target</parameter> is not <constant>GL_TEXTURE_1D_ARRAY</constant> or
492 <constant>GL_PROXY_TEXTURE_1D_ARRAY</constant> and <parameter>height</parameter> is less than 0 or greater than <constant>GL_MAX_TEXTURE_SIZE</constant>.
493 </para>
494 <para>
495 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>target</parameter> is <constant>GL_TEXTURE_1D_ARRAY</constant> or
496 <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>.
497 </para>
498 <para>
499 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>level</parameter> is less than 0.
500 </para>
501 <para>
502 <constant>GL_INVALID_VALUE</constant> may be generated if <parameter>level</parameter> is greater than
503 <inlineequation><mml:math>
504 <!-- eqn: log sub 2 (max): -->
505 <mml:mrow>
506 <mml:msub><mml:mi mathvariant="italic">log</mml:mi>
507 <mml:mn>2</mml:mn>
508 </mml:msub>
509 <mml:mo>&af;</mml:mo>
510 <mml:mfenced open="(" close=")">
511 <mml:mi mathvariant="italic">max</mml:mi>
512 </mml:mfenced>
513 </mml:mrow>
514 </mml:math></inlineequation>,
515 where <emphasis>max</emphasis> is the returned value of <constant>GL_MAX_TEXTURE_SIZE</constant>.
516 </para>
517 <para>
518 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>internalFormat</parameter> is not one of the
519 accepted resolution and format symbolic constants.
520 </para>
521 <para>
522 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>width</parameter> or <parameter>height</parameter> is less than 0
523 or greater than <constant>GL_MAX_TEXTURE_SIZE</constant>.
524 </para>
525 <para>
526 <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
527 <inlineequation><mml:math>
528 <!-- eqn: 2 sup k + 2(border): -->
529 <mml:mrow>
530 <mml:msup><mml:mn>2</mml:mn>
531 <mml:mi mathvariant="italic">k</mml:mi>
532 </mml:msup>
533 <mml:mo>+</mml:mo>
534 <mml:mrow>
535 <mml:mn>2</mml:mn>
536 <mml:mo>&af;</mml:mo>
537 <mml:mfenced open="(" close=")">
538 <mml:mi mathvariant="italic">border</mml:mi>
539 </mml:mfenced>
540 </mml:mrow>
541 </mml:mrow>
542 </mml:math></inlineequation>
543 for some
544 integer value of <emphasis>k</emphasis>.
545 </para>
546 <para>
547 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>border</parameter> is not 0.
548 </para>
549 <para>
550 <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>type</parameter> is one of
551 <constant>GL_UNSIGNED_BYTE_3_3_2</constant>,
552 <constant>GL_UNSIGNED_BYTE_2_3_3_REV</constant>,
553 <constant>GL_UNSIGNED_SHORT_5_6_5</constant>,
554 <constant>GL_UNSIGNED_SHORT_5_6_5_REV</constant>, or
555 <constant>GL_UNSIGNED_INT_10F_11F_11F_REV</constant>,
556 and <parameter>format</parameter> is not <constant>GL_RGB</constant>.
557 </para>
558 <para>
559 <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>type</parameter> is one of
560 <constant>GL_UNSIGNED_SHORT_4_4_4_4</constant>,
561 <constant>GL_UNSIGNED_SHORT_4_4_4_4_REV</constant>,
562 <constant>GL_UNSIGNED_SHORT_5_5_5_1</constant>,
563 <constant>GL_UNSIGNED_SHORT_1_5_5_5_REV</constant>,
564 <constant>GL_UNSIGNED_INT_8_8_8_8</constant>,
565 <constant>GL_UNSIGNED_INT_8_8_8_8_REV</constant>,
566 <constant>GL_UNSIGNED_INT_10_10_10_2</constant>,
567 <constant>GL_UNSIGNED_INT_2_10_10_10_REV</constant>, or
568 <constant>GL_UNSIGNED_INT_5_9_9_9_REV</constant>,
569 and <parameter>format</parameter> is neither <constant>GL_RGBA</constant> nor <constant>GL_BGRA</constant>.
570 </para>
571 <para>
572 <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>target</parameter> is not
573 <constant>GL_TEXTURE_2D</constant>, <constant>GL_PROXY_TEXTURE_2D</constant>,
574 <constant>GL_TEXTURE_RECTANGLE</constant>, or <constant>GL_PROXY_TEXTURE_RECTANGLE</constant>,
575 and <parameter>internalFormat</parameter> is
576 <constant>GL_DEPTH_COMPONENT</constant>, <constant>GL_DEPTH_COMPONENT16</constant>,
577 <constant>GL_DEPTH_COMPONENT24</constant>, or <constant>GL_DEPTH_COMPONENT32F</constant>.
578 </para>
579 <para>
580 <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>format</parameter> is
581 <constant>GL_DEPTH_COMPONENT</constant> and <parameter>internalFormat</parameter> is not
582 <constant>GL_DEPTH_COMPONENT</constant>, <constant>GL_DEPTH_COMPONENT16</constant>,
583 <constant>GL_DEPTH_COMPONENT24</constant>, or <constant>GL_DEPTH_COMPONENT32F</constant>.
584 </para>
585 <para>
586 <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>internalFormat</parameter> is
587 <constant>GL_DEPTH_COMPONENT</constant>, <constant>GL_DEPTH_COMPONENT16</constant>,
588 <constant>GL_DEPTH_COMPONENT24</constant>, or <constant>GL_DEPTH_COMPONENT32F</constant>, and <parameter>format</parameter> is
589 not <constant>GL_DEPTH_COMPONENT</constant>.
590 </para>
591 <para>
592 <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to the
593 <constant>GL_PIXEL_UNPACK_BUFFER</constant> target and the buffer object's data store is currently mapped.
594 </para>
595 <para>
596 <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to the
597 <constant>GL_PIXEL_UNPACK_BUFFER</constant> target and the data would be unpacked from the buffer
598 object such that the memory reads required would exceed the data store size.
599 </para>
600 <para>
601 <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to the
602 <constant>GL_PIXEL_UNPACK_BUFFER</constant> target and <parameter>data</parameter> is not evenly divisible
603 into the number of bytes needed to store in memory a datum indicated by <parameter>type</parameter>.
604 </para>
605 <para>
606 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>target</parameter> is <constant>GL_TEXTURE_RECTANGLE</constant>
607 or <constant>GL_PROXY_TEXTURE_RECTANGLE</constant> and <parameter>level</parameter> is not 0.
608 </para>
609 </refsect1>
610 <refsect1 id="associatedgets"><title>Associated Gets</title>
611 <para>
612 <citerefentry><refentrytitle>glGetTexImage</refentrytitle></citerefentry>
613 </para>
614 <para>
615 <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_PIXEL_UNPACK_BUFFER_BINDING</constant>
616 </para>
617 </refsect1>
618 <refsect1 id="seealso"><title>See Also</title>
619 <para>
620 <citerefentry><refentrytitle>glActiveTexture</refentrytitle></citerefentry>,
621 <citerefentry><refentrytitle>glCopyTexImage1D</refentrytitle></citerefentry>,
622 <citerefentry><refentrytitle>glCopyTexImage2D</refentrytitle></citerefentry>,
623 <citerefentry><refentrytitle>glCopyTexSubImage1D</refentrytitle></citerefentry>,
624 <citerefentry><refentrytitle>glCopyTexSubImage2D</refentrytitle></citerefentry>,
625 <citerefentry><refentrytitle>glCopyTexSubImage3D</refentrytitle></citerefentry>,
626 <citerefentry><refentrytitle>glPixelStore</refentrytitle></citerefentry>,
627 <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>,
628 <citerefentry><refentrytitle>glTexImage3D</refentrytitle></citerefentry>,
629 <citerefentry><refentrytitle>glTexSubImage1D</refentrytitle></citerefentry>,
630 <citerefentry><refentrytitle>glTexSubImage2D</refentrytitle></citerefentry>,
631 <citerefentry><refentrytitle>glTexSubImage3D</refentrytitle></citerefentry>,
632 <citerefentry><refentrytitle>glTexParameter</refentrytitle></citerefentry>
633 </para>
634 </refsect1>
635 <refsect1 id="Copyright"><title>Copyright</title>
636 <para>
637 Copyright <trademark class="copyright"></trademark> 1991-2006
638 Silicon Graphics, Inc. This document is licensed under the SGI
639 Free Software B License. For details, see
640 <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>.
641 </para>
642 </refsect1>
643</refentry>