update upstream sources
[clinton/guile-figl.git] / upstream-doc / man3 / xhtml / glTexSubImage2D.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
3 <!-- saved from url=(0013)about:internet -->
4 <?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="stylesheet" type="text/css" href="opengl-man.css" /><title>glTexSubImage2D - OpenGL 3.3 Reference Pages</title><meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glTexSubImage2D"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glTexSubImage2D — specify a two-dimensional texture subimage</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glTexSubImage2D</b>(</code></td><td>GLenum  </td><td><var class="pdparam">target</var>, </td></tr><tr><td> </td><td>GLint  </td><td><var class="pdparam">level</var>, </td></tr><tr><td> </td><td>GLint  </td><td><var class="pdparam">xoffset</var>, </td></tr><tr><td> </td><td>GLint  </td><td><var class="pdparam">yoffset</var>, </td></tr><tr><td> </td><td>GLsizei  </td><td><var class="pdparam">width</var>, </td></tr><tr><td> </td><td>GLsizei  </td><td><var class="pdparam">height</var>, </td></tr><tr><td> </td><td>GLenum  </td><td><var class="pdparam">format</var>, </td></tr><tr><td> </td><td>GLenum  </td><td><var class="pdparam">type</var>, </td></tr><tr><td> </td><td>const GLvoid *  </td><td><var class="pdparam">data</var><code>)</code>;</td></tr></table></div></div><p>
5 </p><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>target</code></em></span></dt><dd><p>
6 Specifies the target texture.
7 Must be <code class="constant">GL_TEXTURE_2D</code>,
8 <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_X</code>,
9 <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_X</code>,
10 <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_Y</code>,
11 <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_Y</code>,
12 <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_Z</code>,
13 <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_Z</code>,
14 or <code class="constant">GL_TEXTURE_1D_ARRAY</code>.
15 </p></dd><dt><span class="term"><em class="parameter"><code>level</code></em></span></dt><dd><p>
16 Specifies the level-of-detail number.
17 Level 0 is the base image level.
18 Level <span class="emphasis"><em>n</em></span> is the <span class="emphasis"><em>n</em></span>th mipmap reduction image.
19 </p></dd><dt><span class="term"><em class="parameter"><code>xoffset</code></em></span></dt><dd><p>
20 Specifies a texel offset in the x direction within the texture array.
21 </p></dd><dt><span class="term"><em class="parameter"><code>yoffset</code></em></span></dt><dd><p>
22 Specifies a texel offset in the y direction within the texture array.
23 </p></dd><dt><span class="term"><em class="parameter"><code>width</code></em></span></dt><dd><p>
24 Specifies the width of the texture subimage.
25 </p></dd><dt><span class="term"><em class="parameter"><code>height</code></em></span></dt><dd><p>
26 Specifies the height of the texture subimage.
27 </p></dd><dt><span class="term"><em class="parameter"><code>format</code></em></span></dt><dd><p>
28 Specifies the format of the pixel data.
29 The following symbolic values are accepted:
30 <code class="constant">GL_RED</code>,
31 <code class="constant">GL_RG</code>,
32 <code class="constant">GL_RGB</code>,
33 <code class="constant">GL_BGR</code>,
34 <code class="constant">GL_RGBA</code>, and
35 <code class="constant">GL_BGRA</code>.
36 </p></dd><dt><span class="term"><em class="parameter"><code>type</code></em></span></dt><dd><p>
37 Specifies the data type of the pixel data.
38 The following symbolic values are accepted:
39 <code class="constant">GL_UNSIGNED_BYTE</code>,
40 <code class="constant">GL_BYTE</code>,
41 <code class="constant">GL_UNSIGNED_SHORT</code>,
42 <code class="constant">GL_SHORT</code>,
43 <code class="constant">GL_UNSIGNED_INT</code>,
44 <code class="constant">GL_INT</code>,
45 <code class="constant">GL_FLOAT</code>,
46 <code class="constant">GL_UNSIGNED_BYTE_3_3_2</code>,
47 <code class="constant">GL_UNSIGNED_BYTE_2_3_3_REV</code>,
48 <code class="constant">GL_UNSIGNED_SHORT_5_6_5</code>,
49 <code class="constant">GL_UNSIGNED_SHORT_5_6_5_REV</code>,
50 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4</code>,
51 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4_REV</code>,
52 <code class="constant">GL_UNSIGNED_SHORT_5_5_5_1</code>,
53 <code class="constant">GL_UNSIGNED_SHORT_1_5_5_5_REV</code>,
54 <code class="constant">GL_UNSIGNED_INT_8_8_8_8</code>,
55 <code class="constant">GL_UNSIGNED_INT_8_8_8_8_REV</code>,
56 <code class="constant">GL_UNSIGNED_INT_10_10_10_2</code>, and
57 <code class="constant">GL_UNSIGNED_INT_2_10_10_10_REV</code>.
58 </p></dd><dt><span class="term"><em class="parameter"><code>data</code></em></span></dt><dd><p>
59 Specifies a pointer to the image data in memory.
60 </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
61 Texturing maps a portion of a specified texture image
62 onto each graphical primitive for which texturing is enabled.
63 </p><p>
64 <code class="function">glTexSubImage2D</code> redefines a contiguous subregion of an existing two-dimensional
65 or one-dimensional array texture image.
66 The texels referenced by <em class="parameter"><code>data</code></em> replace the portion of the
67 existing texture array with x indices <em class="parameter"><code>xoffset</code></em> and
68 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
69
70 <mml:mrow>
71 <mml:mi mathvariant="italic">xoffset</mml:mi>
72 <mml:mo>+</mml:mo>
73 <mml:mi mathvariant="italic">width</mml:mi>
74 <mml:mo>-</mml:mo>
75 <mml:mn>1</mml:mn>
76 </mml:mrow>
77 </mml:math>,
78 inclusive,
79 and y indices <em class="parameter"><code>yoffset</code></em> and
80 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
81
82 <mml:mrow>
83 <mml:mi mathvariant="italic">yoffset</mml:mi>
84 <mml:mo>+</mml:mo>
85 <mml:mi mathvariant="italic">height</mml:mi>
86 <mml:mo>-</mml:mo>
87 <mml:mn>1</mml:mn>
88 </mml:mrow>
89 </mml:math>,
90 inclusive.
91 This region may not include any texels outside the range of the
92 texture array as it was originally specified.
93 It is not an error to specify a subtexture with zero width or height, but
94 such a specification has no effect.
95 </p><p>
96 If a non-zero named buffer object is bound to the <code class="constant">GL_PIXEL_UNPACK_BUFFER</code> target
97 (see <a href="glBindBuffer.xml"><span class="citerefentry"><span class="refentrytitle">glBindBuffer</span></span></a>) while a texture image is
98 specified, <em class="parameter"><code>data</code></em> is treated as a byte offset into the buffer object's data store.
99 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p>
100 <a href="glPixelStore.xml"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a> modes affect texture images.
101 </p><p>
102 <code class="function">glTexSubImage2D</code> specifies a two-dimensional subtexture for the current texture unit,
103 specified with <a href="glActiveTexture.xml"><span class="citerefentry"><span class="refentrytitle">glActiveTexture</span></span></a>.
104 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
105 <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>target</code></em> is not <code class="constant">GL_TEXTURE_2D</code>,
106 <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_X</code>,
107 <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_X</code>,
108 <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_Y</code>,
109 <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_Y</code>,
110 <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_Z</code>, or
111 <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_Z</code>.
112 </p><p>
113 <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>format</code></em> is not an accepted
114 format constant.
115 </p><p>
116 <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>type</code></em> is not a type constant.
117 </p><p>
118 <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>level</code></em> is less than 0.
119 </p><p>
120 <code class="constant">GL_INVALID_VALUE</code> may be generated if <em class="parameter"><code>level</code></em> is greater
121 than
122 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
123
124 <mml:msub><mml:mi mathvariant="italic">log</mml:mi>
125 <mml:mn>2</mml:mn>
126 </mml:msub>
127 </mml:math>
128 <span class="emphasis"><em>max</em></span>,
129 where <span class="emphasis"><em>max</em></span> is the returned value of <code class="constant">GL_MAX_TEXTURE_SIZE</code>.
130 </p><p>
131 <code class="constant">GL_INVALID_VALUE</code> is generated if
132 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
133
134 <mml:mrow>
135 <mml:mi mathvariant="italic">xoffset</mml:mi>
136 <mml:mo>&lt;</mml:mo>
137 <mml:mn>0</mml:mn>
138 </mml:mrow>
139 </mml:math>,
140 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
141
142 <mml:mrow>
143 <mml:mfenced open="(" close=")">
144 <mml:mrow>
145 <mml:mi mathvariant="italic">xoffset</mml:mi>
146 <mml:mo>+</mml:mo>
147 <mml:mi mathvariant="italic">width</mml:mi>
148 </mml:mrow>
149 </mml:mfenced>
150 <mml:mo>&gt;</mml:mo>
151 <mml:mi mathvariant="italic">w</mml:mi>
152 </mml:mrow>
153 </mml:math>,
154 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
155
156 <mml:mrow>
157 <mml:mi mathvariant="italic">yoffset</mml:mi>
158 <mml:mo>&lt;</mml:mo>
159 <mml:mn>0</mml:mn>
160 </mml:mrow>
161 </mml:math>,
162 or
163 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
164
165 <mml:mrow>
166 <mml:mfenced open="(" close=")">
167 <mml:mrow>
168 <mml:mi mathvariant="italic">yoffset</mml:mi>
169 <mml:mo>+</mml:mo>
170 <mml:mi mathvariant="italic">height</mml:mi>
171 </mml:mrow>
172 </mml:mfenced>
173 <mml:mo>&gt;</mml:mo>
174 <mml:mi mathvariant="italic">h</mml:mi>
175 </mml:mrow>
176 </mml:math>,
177 where
178 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">w</mml:mi></mml:math>
179 is the <code class="constant">GL_TEXTURE_WIDTH</code>, and
180 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">h</mml:mi></mml:math>
181 is the <code class="constant">GL_TEXTURE_HEIGHT</code>
182 of the texture image being modified.
183 </p><p>
184 <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>width</code></em> or <em class="parameter"><code>height</code></em> is less than 0.
185 </p><p>
186 <code class="constant">GL_INVALID_OPERATION</code> is generated if the texture array has not
187 been defined by a previous <a href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a> operation.
188 </p><p>
189 <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>type</code></em> is one of
190 <code class="constant">GL_UNSIGNED_BYTE_3_3_2</code>,
191 <code class="constant">GL_UNSIGNED_BYTE_2_3_3_REV</code>,
192 <code class="constant">GL_UNSIGNED_SHORT_5_6_5</code>, or
193 <code class="constant">GL_UNSIGNED_SHORT_5_6_5_REV</code>
194 and <em class="parameter"><code>format</code></em> is not <code class="constant">GL_RGB</code>.
195 </p><p>
196 <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>type</code></em> is one of
197 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4</code>,
198 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4_REV</code>,
199 <code class="constant">GL_UNSIGNED_SHORT_5_5_5_1</code>,
200 <code class="constant">GL_UNSIGNED_SHORT_1_5_5_5_REV</code>,
201 <code class="constant">GL_UNSIGNED_INT_8_8_8_8</code>,
202 <code class="constant">GL_UNSIGNED_INT_8_8_8_8_REV</code>,
203 <code class="constant">GL_UNSIGNED_INT_10_10_10_2</code>, or
204 <code class="constant">GL_UNSIGNED_INT_2_10_10_10_REV</code>
205 and <em class="parameter"><code>format</code></em> is neither <code class="constant">GL_RGBA</code> nor <code class="constant">GL_BGRA</code>.
206 </p><p>
207 <code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to the
208 <code class="constant">GL_PIXEL_UNPACK_BUFFER</code> target and the buffer object's data store is currently mapped.
209 </p><p>
210 <code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to the
211 <code class="constant">GL_PIXEL_UNPACK_BUFFER</code> target and the data would be unpacked from the buffer
212 object such that the memory reads required would exceed the data store size.
213 </p><p>
214 <code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to the
215 <code class="constant">GL_PIXEL_UNPACK_BUFFER</code> target and <em class="parameter"><code>data</code></em> is not evenly divisible
216 into the number of bytes needed to store in memory a datum indicated by <em class="parameter"><code>type</code></em>.
217 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p>
218 <a href="glGetTexImage.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexImage</span></span></a>
219 </p><p>
220 <a href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_PIXEL_UNPACK_BUFFER_BINDING</code>
221 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
222 <a href="glActiveTexture.xml"><span class="citerefentry"><span class="refentrytitle">glActiveTexture</span></span></a>,
223 <a href="glCopyTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage1D</span></span></a>,
224 <a href="glCopyTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage2D</span></span></a>,
225 <a href="glCopyTexSubImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage1D</span></span></a>,
226 <a href="glCopyTexSubImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage2D</span></span></a>,
227 <a href="glCopyTexSubImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage3D</span></span></a>,
228 <a href="glPixelStore.xml"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a>,
229 <a href="glTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a>,
230 <a href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>,
231 <a href="glTexImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage3D</span></span></a>,
232 <a href="glTexSubImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage1D</span></span></a>,
233 <a href="glTexSubImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage3D</span></span></a>,
234 <a href="glTexParameter.xml"><span class="citerefentry"><span class="refentrytitle">glTexParameter</span></span></a>
235 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p>
236 Copyright <span class="trademark"></span>© 1991-2006
237 Silicon Graphics, Inc. This document is licensed under the SGI
238 Free Software B License. For details, see
239 <a href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>.
240 </p></div></div></body></html>