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
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:mml="http://www.w3.org/1998/Math/MathML"
><head><title>glTexImage2D</title><link rel="stylesheet" href="style.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.59.1"/><link rel="home" href="index.xml" title="PyOpenGL 2.0.1.07 Man Pages"/><link rel="up" href="reference-GL.xml" title="GL"/><link rel="previous" href="glTexImage1D.3G.xml" title="glTexImage1D"/><link rel="next" href="glTexImage3D.3G.xml" title="glTexImage3D"/></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">glTexImage2D</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="glTexImage1D.3G.xml">Prev</a></td><th width="60%" align="center">GL</th><td width="20%" align="right"><a accesskey="n" href="glTexImage3D.3G.xml">Next</a></td></tr></table><hr/></div><div class="refentry" lang="en"><a name="glTexImage2D.3G"/><div class="titlepage"/><div class="refnamediv"><a name="glTexImage2D.3G-name"/><h2>Name</h2><p>glTexImage2D, glTexImage2Db, glTexImage2Df, glTexImage2Di, glTexImage2Ds, glTexImage2Dub, glTexImage2Dui, glTexImage2Dus — specify a two-dimensional texture image</p></div><div class="refsynopsisdiv"><a name="glTexImage2D.3G-c_spec"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void<tt>glTexImage2D</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLenum<i><tt>target</tt></i>, GLint<i><tt>level</tt></i>, GLint<i><tt>internalformat</tt></i>, GLsizei<i><tt>width</tt></i>, GLsizei<i><tt>height</tt></i>, GLint<i><tt>border</tt></i>, GLenum<i><tt>format</tt></i>, GLenum<i><tt>type</tt></i>, constGLvoid*<i><tt>pixels</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glTexImage2D.3G-python_spec"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glTexImage2D</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>target</tt></i>, <i><tt>level</tt></i>, <i><tt>internalformat</tt></i>, <i><tt>width</tt></i>, <i><tt>height</tt></i>, <i><tt>border</tt></i>, <i><tt>format</tt></i>, <i><tt>type</tt></i>, <i><tt>pixels</tt></i>) →<tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glTexImage2Di</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>target</tt></i>, <i><tt>level</tt></i>, <i><tt>internalformat</tt></i>, <i><tt>border</tt></i>, <i><tt>format</tt></i>, <i><tt>type</tt></i>, <i><tt>pixels</tt></i>[][][]) →<tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glTexImage2Df</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>target</tt></i>, <i><tt>level</tt></i>, <i><tt>internalformat</tt></i>, <i><tt>border</tt></i>, <i><tt>format</tt></i>, <i><tt>type</tt></i>, <i><tt>pixels</tt></i>[][][]) →<tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glTexImage2Di</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>target</tt></i>, <i><tt>level</tt></i>, <i><tt>internalformat</tt></i>, <i><tt>border</tt></i>, <i><tt>format</tt></i>, <i><tt>type</tt></i>, <i><tt>pixels</tt></i>[][][]) →<tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glTexImage2Ds</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>target</tt></i>, <i><tt>level</tt></i>, <i><tt>internalformat</tt></i>, <i><tt>border</tt></i>, <i><tt>format</tt></i>, <i><tt>type</tt></i>, <i><tt>pixels</tt></i>[][][]) →<tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glTexImage2Dub</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>target</tt></i>, <i><tt>level</tt></i>, <i><tt>internalformat</tt></i>, <i><tt>border</tt></i>, <i><tt>format</tt></i>, <i><tt>type</tt></i>, <i><tt>pixels</tt></i>[][][]) →<tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glTexImage2Dui</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>target</tt></i>, <i><tt>level</tt></i>, <i><tt>internalformat</tt></i>, <i><tt>border</tt></i>, <i><tt>format</tt></i>, <i><tt>type</tt></i>, <i><tt>pixels</tt></i>[][][]) →<tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glTexImage2Dus</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>target</tt></i>, <i><tt>level</tt></i>, <i><tt>internalformat</tt></i>, <i><tt>border</tt></i>, <i><tt>format</tt></i>, <i><tt>type</tt></i>, <i><tt>pixels</tt></i>[][][]) →<tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glTexImage2D.3G-parameters"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>target</tt></i></span></dt><dd>
Specifies the target texture. Must be <tt>GL_TEXTURE_2D</tt> or
<tt>GL_PROXY_TEXTURE_2D</tt>.
</dd><dt><span class="term"><i><tt>level</tt></i></span></dt><dd>
Specifies the level-of-detail number. Level 0 is the base image level. Level <i><tt>n</tt></i> is
the <i><tt>n</tt></i>th mipmap reduction image.
</dd><dt><span class="term"><i><tt>internalformat</tt></i></span></dt><dd>
Specifies the number of color components in the texture. Must be 1, 2, 3, or 4, or one of the following
symbolic constants: <tt>GL_ALPHA</tt>, <tt>GL_ALPHA4</tt>,
<tt>GL_ALPHA8</tt>, <tt>GL_ALPHA12</tt>, <tt>GL_ALPHA16</tt>,
<tt>GL_LUMINANCE</tt>, <tt>GL_LUMINANCE4</tt>, <tt>GL_LUMINANCE8</tt>,
<tt>GL_LUMINANCE12</tt>, <tt>GL_LUMINANCE16</tt>,
<tt>GL_LUMINANCE_ALPHA</tt>, <tt>GL_LUMINANCE4_ALPHA4</tt>,
<tt>GL_LUMINANCE6_ALPHA2</tt>, <tt>GL_LUMINANCE8_ALPHA8</tt>,
<tt>GL_LUMINANCE12_ALPHA4</tt>, <tt>GL_LUMINANCE12_ALPHA12</tt>,
<tt>GL_LUMINANCE16_ALPHA16</tt>, <tt>GL_INTENSITY</tt>,
<tt>GL_INTENSITY4</tt>, <tt>GL_INTENSITY8</tt>,
<tt>GL_INTENSITY12</tt>, <tt>GL_INTENSITY16</tt>, <tt>GL_R3_G3_B2</tt>,
<tt>GL_RGB</tt>, <tt>GL_RGB4</tt>, <tt>GL_RGB5</tt>,
<tt>GL_RGB8</tt>, <tt>GL_RGB10</tt>, <tt>GL_RGB12</tt>,
<tt>GL_RGB16</tt>, <tt>GL_RGBA</tt>, <tt>GL_RGBA2</tt>,
<tt>GL_RGBA4</tt>, <tt>GL_RGB5_A1</tt>, <tt>GL_RGBA8</tt>,
<tt>GL_RGB10_A2</tt>, <tt>GL_RGBA12</tt>, or <tt>GL_RGBA16</tt>.
</dd><dt><span class="term"><i><tt>width</tt></i></span></dt><dd>
Specifies the width of the texture image. Must be <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
<mml:mrow>
<mml:msup>
<mml:mn>2</mml:mn>
<mml:mi>n</mml:mi>
</mml:msup>
<mml:mo>+</mml:mo>
<mml:mn>2</mml:mn>
<mml:mo>(</mml:mo>
<mml:mi>border</mml:mi>
<mml:mo>)</mml:mo>
</mml:mrow>
</mml:math> for some integer <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
<mml:mi>n</mml:mi>
</mml:math>. All implementations support texture images that are at least 64 texels wide.
</dd><dt><span class="term"><i><tt>height</tt></i></span></dt><dd>
Specifies the height of the texture image. Must be <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
<mml:mrow>
<mml:msup>
<mml:mn>2</mml:mn>
<mml:mi>m</mml:mi>
</mml:msup>
<mml:mo>+</mml:mo>
<mml:mn>2</mml:mn>
<mml:mo>(</mml:mo>
<mml:mi>border</mml:mi>
<mml:mo>)</mml:mo>
</mml:mrow>
</mml:math> for some integer <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
<mml:mi>m</mml:mi>
</mml:math>. All implementations support texture images that are at least 64 texels high.
</dd><dt><span class="term"><i><tt>border</tt></i></span></dt><dd>
Specifies the width of the border. Must be either 0 or 1.
</dd><dt><span class="term"><i><tt>format</tt></i></span></dt><dd>
Specifies the of the pixel data. The following symbolic values are accepted:
<tt>GL_COLOR_INDEX</tt>, <tt>GL_RED</tt>, <tt>GL_GREEN</tt>,
<tt>GL_BLUE</tt>, <tt>GL_ALPHA</tt>, <tt>GL_RGB</tt>,
<tt>GL_BGR</tt> <tt>GL_RGBA</tt>, <tt>GL_BGRA</tt>,
<tt>GL_LUMINANCE</tt>, and <tt>GL_LUMINANCE_ALPHA</tt>.
</dd><dt><span class="term"><i><tt>type</tt></i></span></dt><dd>
Specifies the data type of the pixel data. The following symbolic values are accepted:
<tt>GL_UNSIGNED_BYTE</tt>, <tt>GL_BYTE</tt>, <tt>GL_BITMAP</tt>,
<tt>GL_UNSIGNED_SHORT</tt>, <tt>GL_SHORT</tt>,
<tt>GL_UNSIGNED_INT</tt>, <tt>GL_INT</tt>, <tt>GL_FLOAT</tt>,
<tt>GL_UNSIGNED_BYTE_3_3_2</tt>, <tt>GL_UNSIGNED_BYTE_2_3_3_REV</tt>,
<tt>GL_UNSIGNED_SHORT_5_6_5</tt>, <tt>GL_UNSIGNED_SHORT_5_6_5_REV</tt>,
<tt>GL_UNSIGNED_SHORT_4_4_4_4</tt>, <tt>GL_UNSIGNED_SHORT_4_4_4_4_REV</tt>,
<tt>GL_UNSIGNED_SHORT_5_5_5_1</tt>, <tt>GL_UNSIGNED_SHORT_1_5_5_5_REV</tt>,
<tt>GL_UNSIGNED_INT_8_8_8_8</tt>, <tt>GL_UNSIGNED_INT_8_8_8_8_REV</tt>,
<tt>GL_UNSIGNED_INT_10_10_10_2</tt>, and <tt>GL_UNSIGNED_INT_2_10_10_10_REV</tt>.
</dd><dt><span class="term"><i><tt>pixels</tt></i></span></dt><dd>
Specifies a pointer to the image data in memory.
</dd></dl></div></div><div class="refsect1" lang="en"><a name="glTexImage2D.3G-description"/><h2>Description</h2><p>
Texturing maps a portion of a specified texture image onto each graphical primitive for which texturing is enabled. To
enable and disable two-dimensional texturing, call <a href="glEnable.3G.xml"><tt>glEnable</tt></a> and <a href="glEnable.3G.xml"><tt>glDisable</tt></a> with argument <tt>GL_TEXTURE_2D</tt>.
</p><p>
To define texture images, call <tt>glTexImage2D</tt>. The arguments describe the parameters of the texture
image, such as height, width, width of the border, level-of-detail number (see <a href="glTexParameter.3G.xml">glTexParameter</a>), and number of color components provided. The last three arguments describe how the image is
represented in memory; they are identical to the pixel formats used for <a href="glDrawPixels.3G.xml"><tt>glDrawPixels</tt></a>.
</p><p>
If <i><tt>target</tt></i> is <tt>GL_PROXY_TEXTURE_2D</tt>, no data is read from
<i><tt>pixels</tt></i>, 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 <a href="glGetError.3G.xml">glGetError</a>). To query for an entire mipmap array, use an image array level greater than or equal to 1.
</p><p>
If <i><tt>target</tt></i> is <tt>GL_TEXTURE_2D</tt>, data is read from <i><tt>pixels</tt></i>
as a sequence of signed or unsigned bytes, shorts, or longs, or single-precision floating-point values, depending on
<i><tt>type</tt></i>. These values are grouped into sets of one, two, three, or four values, depending on
<i><tt>format</tt></i>, to form elements. If <i><tt>type</tt></i> is <tt>GL_BITMAP</tt>, the
data is considered as a string of unsigned bytes (and <i><tt>format</tt></i> must be
<tt>GL_COLOR_INDEX</tt>). Each data byte is treated as eight 1-bit elements, with bit ordering determined
by <tt>GL_UNPACK_LSB_FIRST</tt> (see <a href="glPixelStore.3G.xml">glPixelStore</a>).
</p><p>
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.
</p><p>
<i><tt>format</tt></i> determines the composition of each element in <i><tt>pixels</tt></i>. It can
assume one of eleven symbolic values:
</p><div class="variablelist"><dl><dt><span class="term"><tt>GL_COLOR_INDEX</tt></span></dt><dd>
Each element is a single value, a color index. The GL converts it to fixed point (with an unspecified
number of zero bits to the right of the binary point), shifted left or right depending on the value and
sign of <tt>GL_INDEX_SHIFT</tt>, and added to <tt>GL_INDEX_OFFSET</tt> (see
</dd></dl></div><p>
<tt>glPixelTransfer</tt>). The resulting index is converted to a set of color
components using the <tt>GL_PIXEL_MAP_I_TO_R</tt>, <tt>GL_PIXEL_MAP_I_TO_G</tt>,
<tt>GL_PIXEL_MAP_I_TO_B</tt>, and <tt>GL_PIXEL_MAP_I_TO_A</tt> tables, and clamped to the range
[0,1].
</p><div class="variablelist"><dl><dt><span class="term"><tt>GL_RED</tt></span></dt><dd>
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 then multiplied by the signed
scale factor <tt>GL_c_SCALE</tt>, added to the signed bias <tt>GL_c_BIAS</tt>, and
clamped to the range [0,1] (see <a href="glPixelTransfer.3G.xml">glPixelTransfer</a>).
</dd><dt><span class="term"><tt>GL_GREEN</tt></span></dt><dd>
Each element is a single green component. The GL converts it to floating point and assembles it into an
RGBA element by attaching 0 for red and blue, and 1 for alpha. Each component is then multiplied by the
signed scale factor <tt>GL_c_SCALE</tt>, added to the signed bias
<tt>GL_c_BIAS</tt>, and clamped to the range [0,1] (see <a href="glPixelTransfer.3G.xml">glPixelTransfer</a>).
</dd><dt><span class="term"><tt>GL_BLUE</tt></span></dt><dd>
Each element is a single blue component. The GL converts it to floating point and assembles it into an RGBA
element by attaching 0 for red and green, and 1 for alpha. Each component is then multiplied by the signed
scale factor <tt>GL_c_SCALE</tt>, added to the signed bias <tt>GL_c_BIAS</tt>, and
clamped to the range [0,1] (see <a href="glPixelTransfer.3G.xml">glPixelTransfer</a>).
</dd><dt><span class="term"><tt>GL_ALPHA</tt></span></dt><dd>
Each element is a single alpha component. The GL converts it to floating point and assembles it into an
RGBA element by attaching 0 for red, green, and blue. Each component is then multiplied by the signed scale
factor <tt>GL_c_SCALE</tt>, added to the signed bias <tt>GL_c_BIAS</tt>, and
clamped to the range [0,1] (see <a href="glPixelTransfer.3G.xml">glPixelTransfer</a>).
</dd><dt><span class="term"><tt>GL_BGR</tt>, </span><span class="term"><tt>GL_RGB</tt></span></dt><dd>
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 then multiplied by the signed scale factor
<tt>GL_c_SCALE</tt>, added to the signed bias <tt>GL_c_BIAS</tt>, and clamped to
the range [0,1] (see <a href="glPixelTransfer.3G.xml">glPixelTransfer</a>).
</dd><dt><span class="term"><tt>GL_BGRA</tt>, </span><span class="term"><tt>GL_RGBA</tt></span></dt><dd>
Each element contains all four components. Each component is multiplied by the signed scale factor
<tt>GL_c_SCALE</tt>, added to the signed bias <tt>GL_c_BIAS</tt>, and clamped to
the range [0,1] (see <a href="glPixelTransfer.3G.xml">glPixelTransfer</a>).
</dd><dt><span class="term"><tt>GL_LUMINANCE</tt></span></dt><dd>
Each element is a single luminance value. The GL converts it to floating point, then assembles it into an
RGBA element by replicating the luminance value three times for red, green, and blue and attaching 1 for
alpha. Each component is then multiplied by the signed scale factor <tt>GL_c_SCALE</tt>, added
to the signed bias <tt>GL_c_BIAS</tt>, and clamped to the range [0,1] (see <a href="glPixelTransfer.3G.xml">glPixelTransfer</a>).
</dd><dt><span class="term"><tt>GL_LUMINANCE_ALPHA</tt></span></dt><dd>
Each element is a luminance/alpha pair. The GL converts it to floating point, then assembles it into an
RGBA element by replicating the luminance value three times for red, green, and blue. Each component is
then multiplied by the signed scale factor <tt>GL_c_SCALE</tt>, added to the signed bias
<tt>GL_c_BIAS</tt>, and clamped to the range [0,1] (see <a href="glPixelTransfer.3G.xml">glPixelTransfer</a>).
</dd></dl></div><p>
Refer to the <a href="glDrawPixels.3G.xml"><tt>glDrawPixels</tt></a> reference page for a description of the acceptable
values for the <i><tt>type</tt></i> parameter.
</p><p>
If an application wants to store the texture at a certain resolution or in a certain , it can request the resolution
and with <i><tt>internalformat</tt></i>. The GL will choose an internal representation that closely approximates
that requested by <i><tt>internalformat</tt></i>, but it may not match exactly. (The representations specified
by <tt>GL_LUMINANCE</tt>, <tt>GL_LUMINANCE_ALPHA</tt>, <tt>GL_RGB</tt>, and
<tt>GL_RGBA</tt> must match exactly. The numeric values 1, 2, 3, and 4 may also be used to specify the
above representations.)
</p><p>
Use the <tt>GL_PROXY_TEXTURE_2D</tt> target to try out a resolution and the implementation will update and
recompute its best match for the requested storage resolution and . To then query this state, call <tt>glGetTexLevelParameter</tt>. If the texture cannot be accommodated, texture state is set to
0.
</p><p>
A one-component texture image uses only the red component of the RGBA color extracted from
<i><tt>pixels</tt></i>. A two-component image uses the R and A values. A three-component image uses the R, G,
and B values. A four-component image uses all of the RGBA components.
</p></div><div class="refsect1" lang="en"><a name="glTexImage2D.3G-notes"/><h2>Notes</h2><p>
Texturing has no effect in color index mode.
</p><p>
If the <tt>GL_ARB_imaging</tt> extension is supported, RGBA elements may also be processed by the imaging
pipeline. The following stages may be applied to an RGBA color before color component clamping to the range [0,1]:
</p><div class="variablelist"><dl><dt><span class="term">1. Color component replacement by the color table specified for</span></dt><dd>
<tt>GL_COLOR_TABLE</tt>, if enabled. See <a href="glColorTable.3G.xml"><tt>glColorTable</tt></a>.
</dd><dt><span class="term">2. Two-dimensional Convolution filtering, if enabled. See</span></dt><dd><p>
<a href="glConvolutionFilter1D.3G.xml"><tt>glConvolutionFilter1D</tt></a>.
</p><p>
If a convolution filter changes the __width of the texture (by processing with a
<tt>GL_CONVOLUTION_BORDER_MODE</tt> of <tt>GL_REDUCE</tt>, for example), the
<i><tt>width</tt></i> must <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
<mml:mrow>
<mml:msup>
<mml:mn>2</mml:mn>
<mml:mi>n</mml:mi>
</mml:msup>
<mml:mo>+</mml:mo>
<mml:mn>2</mml:mn>
<mml:mo>(</mml:mo>
<mml:mi>height</mml:mi>
<mml:mo>)</mml:mo>
</mml:mrow>
</mml:math>, for some integer <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
<mml:mi>n</mml:mi>
</mml:math>, and <i><tt>height</tt></i> must be <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
<mml:mrow>
<mml:msup>
<mml:mn>2</mml:mn>
<mml:mi>m</mml:mi>
</mml:msup>
<mml:mo>+</mml:mo>
<mml:mo>(</mml:mo>
<mml:mi>border</mml:mi>
<mml:mo>)</mml:mo>
</mml:mrow>
</mml:math>, for some integer <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
<mml:mi>m</mml:mi>
</mml:math>, after filtering.
</p></dd><dt><span class="term">3. RGBA components may be multiplied by <tt>GL_POST_CONVOLUTION_c_SCALE</tt>,</span></dt><dd>
and added to <tt>GL_POST_CONVOLUTION_c_BIAS</tt>, if enabled. See <tt>glPixelTransfer</tt>.
</dd><dt><span class="term">4. Color component replacement by the color table specified for</span></dt><dd>
<tt>GL_POST_CONVOLUTION_COLOR_TABLE</tt>, if enabled. See <a href="glColorTable.3G.xml"><tt>glColorTable</tt></a>.
</dd><dt><span class="term">6. RGBA components may be multiplied by <tt>GL_POST_COLOR_MATRIX_c_SCALE</tt>,, </span><span class="term">5. Transformation by the color matrix. See <a href="glMatrixMode.3G.xml"><tt>glMatrixMode</tt></a>.</span></dt><dd>
and added to <tt>GL_POST_COLOR_MATRIX_c_BIAS</tt>, if enabled. See <tt>glPixelTransfer</tt>.
</dd><dt><span class="term">7. Color component replacement by the color table specified for</span></dt><dd>
<tt>GL_POST_COLOR_MATRIX_COLOR_TABLE</tt>, if enabled. See <a href="glColorTable.3G.xml"><tt>glColorTable</tt></a>.
</dd></dl></div><p>
The texture image can be represented by the same data formats as the pixels in a <a href="glDrawPixels.3G.xml"><tt>glDrawPixels</tt></a> command, except that <tt>GL_STENCIL_INDEX</tt> and
<tt>GL_DEPTH_COMPONENT</tt> cannot be used. <tt>glPixelStore</tt> and
<tt>glPixelTransfer</tt> modes affect texture images in exactly the way they affect
<a href="glDrawPixels.3G.xml"><tt>glDrawPixels</tt></a>.
</p><p>
<tt>glTexImage2D</tt> and <tt>GL_PROXY_TEXTURE_2D</tt> are available only if the GL version is
1.1 or greater.
</p><p>
Internal formats other than 1, 2, 3, or 4 may be used only if the GL version is 1.1 or greater.
</p><p>
In GL version 1.1 or greater, <i><tt>pixels</tt></i> may be a <tt>NULL</tt> pointer. In this case
texture memory is allocated to accommodate a texture of width <i><tt>width</tt></i> and height
<i><tt>height</tt></i>. 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.
</p><p>
Formats <tt>GL_BGR</tt>, and <tt>GL_BGRA</tt> and types
<tt>GL_UNSIGNED_BYTE_3_3_2</tt>, <tt>GL_UNSIGNED_BYTE_2_3_3_REV</tt>,
<tt>GL_UNSIGNED_SHORT_5_6_5</tt>, <tt>GL_UNSIGNED_SHORT_5_6_5_REV</tt>,
<tt>GL_UNSIGNED_SHORT_4_4_4_4</tt>, <tt>GL_UNSIGNED_SHORT_4_4_4_4_REV</tt>,
<tt>GL_UNSIGNED_SHORT_5_5_5_1</tt>, <tt>GL_UNSIGNED_SHORT_1_5_5_5_REV</tt>,
<tt>GL_UNSIGNED_INT_8_8_8_8</tt>, <tt>GL_UNSIGNED_INT_8_8_8_8_REV</tt>,
<tt>GL_UNSIGNED_INT_10_10_10_2</tt>, and <tt>GL_UNSIGNED_INT_2_10_10_10_REV</tt> are available
only if the GL version is 1.2 or greater.
</p><p>
When the <tt>GL_ARB_multitexture</tt> extension is supported, <tt>glTexImage2D</tt> specifies
the two-dimensional texture for the current texture unit, specified with <a href="glActiveTextureARB.3G.xml"><tt>glActiveTextureARB</tt></a>.
</p></div><div class="refsect1" lang="en"><a name="glTexImage2D.3G-errors"/><h2>Errors</h2><p>
<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>target</tt></i> is not
<tt>GL_TEXTURE_2D</tt> or <tt>GL_PROXY_TEXTURE_2D</tt>.
</p><p>
<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>format</tt></i> is not an accepted constant. Format
constants other than <tt>GL_STENCIL_INDEX</tt> and <tt>GL_DEPTH_COMPONENT</tt> are accepted.
</p><p>
<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>type</tt></i> is not a type constant.
</p><p>
<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>type</tt></i> is <tt>GL_BITMAP</tt> and
<i><tt>format</tt></i> is not <tt>GL_COLOR_INDEX</tt>.
</p><p>
<tt>GL_INVALID_VALUE</tt> is generated if <i><tt>level</tt></i> is less than 0.
</p><p>
<tt>GL_INVALID_VALUE</tt> may be generated if <i><tt>level</tt></i> is greater than <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
<mml:msub>
<mml:mi>log</mml:mi>
<mml:mn>2</mml:mn>
</mml:msub>
</mml:math><i><tt>max</tt></i>, where <i><tt>max</tt></i> is the returned value of
<tt>GL_MAX_TEXTURE_SIZE</tt>.
</p><p>
<tt>GL_INVALID_VALUE</tt> is generated if <i><tt>internalformat</tt></i> is not 1, 2, 3, 4, or one
of the accepted resolution and symbolic constants.
</p><p>
<tt>GL_INVALID_VALUE</tt> is generated if <i><tt>width</tt></i> or <i><tt>height</tt></i> is
less than 0 or greater than 2 + <tt>GL_MAX_TEXTURE_SIZE</tt>, or if either cannot be represented as
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
<mml:mrow>
<mml:msup>
<mml:mn>2</mml:mn>
<mml:mi>k</mml:mi>
</mml:msup>
<mml:mo>+</mml:mo>
<mml:mn>2</mml:mn>
<mml:mo>(</mml:mo>
<mml:mi>border</mml:mi>
<mml:mo>)</mml:mo>
</mml:mrow>
</mml:math> for some integer value of <i><tt>k</tt></i>.
</p><p>
<tt>GL_INVALID_VALUE</tt> is generated if <i><tt>border</tt></i> is not 0 or 1.
</p><p>
<tt>GL_INVALID_OPERATION</tt> is generated if <tt>glTexImage2D</tt> is executed between the
execution of <a href="glBegin.3G.xml"><tt>glBegin</tt></a> and the corresponding execution of <a href="glBegin.3G.xml"><tt>glEnd</tt></a>.
</p><p>
<tt>GL_INVALID_OPERATION</tt> is generated if <i><tt>type</tt></i> is one of
<tt>GL_UNSIGNED_BYTE_3_3_2</tt>, <tt>GL_UNSIGNED_BYTE_2_3_3_REV</tt>,
<tt>GL_UNSIGNED_SHORT_5_6_5</tt>, or <tt>GL_UNSIGNED_SHORT_5_6_5_REV</tt> and
<i><tt>format</tt></i> is not <tt>GL_RGB</tt>.
</p><p>
<tt>GL_INVALID_OPERATION</tt> is generated if <i><tt>type</tt></i> is one of
<tt>GL_UNSIGNED_SHORT_4_4_4_4</tt>, <tt>GL_UNSIGNED_SHORT_4_4_4_4_REV</tt>,
<tt>GL_UNSIGNED_SHORT_5_5_5_1</tt>, <tt>GL_UNSIGNED_SHORT_1_5_5_5_REV</tt>,
<tt>GL_UNSIGNED_INT_8_8_8_8</tt>, <tt>GL_UNSIGNED_INT_8_8_8_8_REV</tt>,
<tt>GL_UNSIGNED_INT_10_10_10_2</tt>, or <tt>GL_UNSIGNED_INT_2_10_10_10_REV</tt> and
<i><tt>format</tt></i> is neither <tt>GL_RGBA</tt> nor <tt>GL_BGRA</tt>.
</p></div><div class="refsect1" lang="en"><a name="glTexImage2D.3G-associated_gets"/><h2>Associated Gets</h2><p>
<a href="glGetTexImage.3G.xml"><tt>glGetTexImage</tt></a>
</p><p>
<a href="glIsEnabled.3G.xml"><tt>glIsEnabled</tt></a> with argument <tt>GL_TEXTURE_2D</tt>
</p></div><div class="refsect1" lang="en"><a name="glTexImage2D.3G-see_also"/><h2>See Also</h2><p>
<span class="simplelist"><a href="glColorTable.3G.xml">glColorTable</a>, <a href="glConvolutionFilter2D.3G.xml">glConvolutionFilter2D</a>, <a href="glCopyPixels.3G.xml">glCopyPixels</a>, <a href="glCopyTexImage1D.3G.xml">glCopyTexImage1D</a>, <a href="glCopyTexImage2D.3G.xml">glCopyTexImage2D</a>, <a href="glCopyTexSubImage1D.3G.xml">glCopyTexSubImage1D</a>, <a href="glCopyTexSubImage2D.3G.xml">glCopyTexSubImage2D</a>, <a href="glCopyTexSubImage3D.3G.xml">glCopyTexSubImage3D</a>, <a href="glDrawPixels.3G.xml">glDrawPixels</a>, <a href="glMatrixMode.3G.xml">glMatrixMode</a>, <a href="glPixelStore.3G.xml">glPixelStore</a>, <a href="glPixelTransfer.3G.xml">glPixelTransfer</a>, <a href="glSeparableFilter2D.3G.xml">glSeparableFilter2D</a>, <a href="glTexEnv.3G.xml">glTexEnv</a>, <a href="glTexGen.3G.xml">glTexGen</a>, <a href="glTexImage1D.3G.xml">glTexImage1D</a>, <a href="glTexImage3D.3G.xml">glTexImage3D</a>, <a href="glTexSubImage1D.3G.xml">glTexSubImage1D</a>, <a href="glTexSubImage2D.3G.xml">glTexSubImage2D</a>, <a href="glTexSubImage3D.3G.xml">glTexSubImage3D</a>, <a href="glTexParameter.3G.xml">glTexParameter</a></span>
</p></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="glTexImage1D.3G.xml">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="reference-GL.xml">Up</a></td><td width="40%" align="right"><a accesskey="n" href="glTexImage3D.3G.xml">Next</a></td></tr><tr><td width="40%" align="left" valign="top">glTexImage1D</td><td width="20%" align="center"><a accesskey="h" href="index.xml">Home</a></td><td width="40%" align="right" valign="top">glTexImage3D</td></tr></table></div></body></html>
|