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