Commit | Line | Data |
---|---|---|
7faf1d71 AW |
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>glCopyTexSubImage2D - OpenGL 4 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="glCopyTexSubImage2D"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glCopyTexSubImage2D — copy 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">glCopyTexSubImage2D</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>GLint </td><td><var class="pdparam">x</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">y</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><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>, or | |
14 | <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>x</code></em>, </span><span class="term"><em class="parameter"><code>y</code></em></span></dt><dd><p> | |
24 | Specify the window coordinates of the lower left corner | |
25 | of the rectangular region of pixels to be copied. | |
26 | </p></dd><dt><span class="term"><em class="parameter"><code>width</code></em></span></dt><dd><p> | |
27 | Specifies the width of the texture subimage. | |
28 | </p></dd><dt><span class="term"><em class="parameter"><code>height</code></em></span></dt><dd><p> | |
29 | Specifies the height of the texture subimage. | |
30 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> | |
31 | <code class="function">glCopyTexSubImage2D</code> replaces a rectangular portion of a two-dimensional texture image, | |
32 | cube-map texture image or a linear portion of a number of slices of a one-dimensional array texture | |
33 | with pixels from the current <code class="constant">GL_READ_BUFFER</code> | |
34 | (rather than from main memory, as is the case for <a href="glTexSubImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage2D</span></span></a>). | |
35 | </p><p> | |
36 | The screen-aligned pixel rectangle with lower left corner at | |
37 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
38 | ||
39 | <mml:mfenced open="(" close=")"> | |
40 | <mml:mi mathvariant="italic">x</mml:mi> | |
41 | <mml:mi mathvariant="italic">y</mml:mi> | |
42 | </mml:mfenced> | |
43 | </mml:math> | |
44 | and with | |
45 | width <em class="parameter"><code>width</code></em> and height <em class="parameter"><code>height</code></em> replaces the portion of the | |
46 | texture array with x indices <em class="parameter"><code>xoffset</code></em> through | |
47 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
48 | ||
49 | <mml:mrow> | |
50 | <mml:mi mathvariant="italic">xoffset</mml:mi> | |
51 | <mml:mo>+</mml:mo> | |
52 | <mml:mi mathvariant="italic">width</mml:mi> | |
53 | <mml:mo>-</mml:mo> | |
54 | <mml:mn>1</mml:mn> | |
55 | </mml:mrow> | |
56 | </mml:math>, | |
57 | inclusive, and y indices <em class="parameter"><code>yoffset</code></em> through | |
58 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
59 | ||
60 | <mml:mrow> | |
61 | <mml:mi mathvariant="italic">yoffset</mml:mi> | |
62 | <mml:mo>+</mml:mo> | |
63 | <mml:mi mathvariant="italic">height</mml:mi> | |
64 | <mml:mo>-</mml:mo> | |
65 | <mml:mn>1</mml:mn> | |
66 | </mml:mrow> | |
67 | </mml:math>, | |
68 | inclusive, at the mipmap level specified by <em class="parameter"><code>level</code></em>. | |
69 | </p><p> | |
70 | The pixels in the rectangle are processed exactly as if | |
71 | <a href="glReadPixels.xml"><span class="citerefentry"><span class="refentrytitle">glReadPixels</span></span></a> had been called, but the process stops just before | |
72 | final conversion. | |
73 | At this point, all pixel component values are clamped to the range | |
74 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
75 | ||
76 | <mml:mfenced open="[" close="]"> | |
77 | <mml:mn>0</mml:mn> | |
78 | <mml:mn>1</mml:mn> | |
79 | </mml:mfenced> | |
80 | </mml:math> | |
81 | and then converted to the texture's internal format for storage in the texel | |
82 | array. | |
83 | </p><p> | |
84 | The destination rectangle in the texture array may not include any texels | |
85 | outside the texture array as it was originally specified. | |
86 | It is not an error to specify a subtexture with zero width or height, but | |
87 | such a specification has no effect. | |
88 | </p><p> | |
89 | When <em class="parameter"><code>target</code></em> is <code class="constant">GL_TEXTURE_1D_ARRAY</code> | |
90 | then the y coordinate and height are treated as the start slice and number | |
91 | of slices to modify. | |
92 | </p><p> | |
93 | If any of the pixels within the specified rectangle of the current | |
94 | <code class="constant">GL_READ_BUFFER</code> are outside the read window associated with the current | |
95 | rendering context, then the values obtained for those pixels are undefined. | |
96 | </p><p> | |
97 | No change is made to the <span class="emphasis"><em>internalformat</em></span>, <span class="emphasis"><em>width</em></span>, | |
98 | <span class="emphasis"><em>height</em></span>, or <span class="emphasis"><em>border</em></span> parameters of the specified texture | |
99 | array or to texel values outside the specified subregion. | |
100 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p> | |
101 | <a href="glPixelStore.xml"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a> modes affect texture images. | |
102 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p> | |
103 | <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>, | |
104 | <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_X</code>, | |
105 | <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_X</code>, | |
106 | <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_Y</code>, | |
107 | <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_Y</code>, | |
108 | <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_Z</code>, | |
109 | <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_Z</code>, or | |
110 | <code class="constant">GL_TEXTURE_1D_ARRAY</code>. | |
111 | </p><p> | |
112 | <code class="constant">GL_INVALID_OPERATION</code> is generated if the texture array has not been | |
113 | defined by a previous <a href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a> or <a href="glCopyTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage2D</span></span></a> operation. | |
114 | </p><p> | |
115 | <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>level</code></em> is less than 0. | |
116 | </p><p> | |
117 | <code class="constant">GL_INVALID_VALUE</code> may be generated if | |
118 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
119 | ||
120 | <mml:mrow> | |
121 | <mml:mi mathvariant="italic">level</mml:mi> | |
122 | <mml:mo>></mml:mo> | |
123 | <mml:mrow> | |
124 | <mml:msub><mml:mi mathvariant="italic">log</mml:mi> | |
125 | <mml:mn>2</mml:mn> | |
126 | </mml:msub> | |
127 | <mml:mo></mml:mo> | |
128 | <mml:mfenced open="(" close=")"> | |
129 | <mml:mi mathvariant="italic">max</mml:mi> | |
130 | </mml:mfenced> | |
131 | </mml:mrow> | |
132 | </mml:mrow> | |
133 | </mml:math>, | |
134 | where | |
135 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">max</mml:mi></mml:math> | |
136 | is the returned value of <code class="constant">GL_MAX_TEXTURE_SIZE</code>. | |
137 | </p><p> | |
138 | <code class="constant">GL_INVALID_VALUE</code> is generated if | |
139 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
140 | ||
141 | <mml:mrow> | |
142 | <mml:mi mathvariant="italic">xoffset</mml:mi> | |
143 | <mml:mo><</mml:mo> | |
144 | <mml:mrow> | |
145 | <mml:mo>-</mml:mo> | |
146 | <mml:mi mathvariant="italic">b</mml:mi> | |
147 | </mml:mrow> | |
148 | </mml:mrow> | |
149 | </mml:math>, | |
150 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
151 | ||
152 | <mml:mrow> | |
153 | <mml:mfenced open="(" close=")"> | |
154 | <mml:mrow> | |
155 | <mml:mi mathvariant="italic">xoffset</mml:mi> | |
156 | <mml:mo>+</mml:mo> | |
157 | <mml:mi mathvariant="italic">width</mml:mi> | |
158 | </mml:mrow> | |
159 | </mml:mfenced> | |
160 | <mml:mo>></mml:mo> | |
161 | <mml:mfenced open="(" close=")"> | |
162 | <mml:mrow> | |
163 | <mml:mi mathvariant="italic">w</mml:mi> | |
164 | <mml:mo>-</mml:mo> | |
165 | <mml:mi mathvariant="italic">b</mml:mi> | |
166 | </mml:mrow> | |
167 | </mml:mfenced> | |
168 | </mml:mrow> | |
169 | </mml:math>, | |
170 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
171 | ||
172 | <mml:mrow> | |
173 | <mml:mi mathvariant="italic">yoffset</mml:mi> | |
174 | <mml:mo><</mml:mo> | |
175 | <mml:mrow> | |
176 | <mml:mo>-</mml:mo> | |
177 | <mml:mi mathvariant="italic">b</mml:mi> | |
178 | </mml:mrow> | |
179 | </mml:mrow> | |
180 | </mml:math>, | |
181 | or | |
182 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
183 | ||
184 | <mml:mrow> | |
185 | <mml:mfenced open="(" close=")"> | |
186 | <mml:mrow> | |
187 | <mml:mi mathvariant="italic">yoffset</mml:mi> | |
188 | <mml:mo>+</mml:mo> | |
189 | <mml:mi mathvariant="italic">height</mml:mi> | |
190 | </mml:mrow> | |
191 | </mml:mfenced> | |
192 | <mml:mo>></mml:mo> | |
193 | <mml:mfenced open="(" close=")"> | |
194 | <mml:mrow> | |
195 | <mml:mi mathvariant="italic">h</mml:mi> | |
196 | <mml:mo>-</mml:mo> | |
197 | <mml:mi mathvariant="italic">b</mml:mi> | |
198 | </mml:mrow> | |
199 | </mml:mfenced> | |
200 | </mml:mrow> | |
201 | </mml:math>, | |
202 | where | |
203 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">w</mml:mi></mml:math> | |
204 | is the <code class="constant">GL_TEXTURE_WIDTH</code>, | |
205 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">h</mml:mi></mml:math> | |
206 | is the <code class="constant">GL_TEXTURE_HEIGHT</code>, | |
207 | and | |
208 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">b</mml:mi></mml:math> | |
209 | is the <code class="constant">GL_TEXTURE_BORDER</code> | |
210 | of the texture image being modified. | |
211 | Note that | |
212 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">w</mml:mi></mml:math> | |
213 | and | |
214 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">h</mml:mi></mml:math> | |
215 | include twice the border width. | |
216 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p> | |
217 | <a href="glGetTexImage.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexImage</span></span></a> | |
218 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> | |
219 | <a href="glCopyTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage1D</span></span></a>, | |
220 | <a href="glCopyTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage2D</span></span></a>, | |
221 | <a href="glCopyTexSubImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage1D</span></span></a>, | |
222 | <a href="glCopyTexSubImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage3D</span></span></a>, | |
223 | <a href="glPixelStore.xml"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a>, | |
224 | <a href="glReadBuffer.xml"><span class="citerefentry"><span class="refentrytitle">glReadBuffer</span></span></a>, | |
225 | <a href="glTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a>, | |
226 | <a href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>, | |
227 | <a href="glTexImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage3D</span></span></a>, | |
228 | <a href="glTexParameter.xml"><span class="citerefentry"><span class="refentrytitle">glTexParameter</span></span></a>, | |
229 | <a href="glTexSubImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage1D</span></span></a>, | |
230 | <a href="glTexSubImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage2D</span></span></a>, | |
231 | <a href="glTexSubImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage3D</span></span></a> | |
232 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
233 | Copyright <span class="trademark"></span>© 1991-2006 | |
234 | Silicon Graphics, Inc. Copyright <span class="trademark"></span>© 2012 Khronos Group. | |
235 | This document is licensed under the SGI | |
236 | Free Software B License. For details, see | |
237 | <a href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>. | |
238 | </p></div></div></body></html> |