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