| 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN" |
| 3 | "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd"> |
| 4 | <refentry id="glCopyTexImage2D"> |
| 5 | <refmeta> |
| 6 | <refmetainfo> |
| 7 | <copyright> |
| 8 | <year>1991-2006</year> |
| 9 | <holder>Silicon Graphics, Inc.</holder> |
| 10 | </copyright> |
| 11 | </refmetainfo> |
| 12 | <refentrytitle>glCopyTexImage2D</refentrytitle> |
| 13 | <manvolnum>3G</manvolnum> |
| 14 | </refmeta> |
| 15 | <refnamediv> |
| 16 | <refname>glCopyTexImage2D</refname> |
| 17 | <refpurpose>copy pixels into a 2D texture image</refpurpose> |
| 18 | </refnamediv> |
| 19 | <refsynopsisdiv><title>C Specification</title> |
| 20 | <funcsynopsis> |
| 21 | <funcprototype> |
| 22 | <funcdef>void <function>glCopyTexImage2D</function></funcdef> |
| 23 | <paramdef>GLenum <parameter>target</parameter></paramdef> |
| 24 | <paramdef>GLint <parameter>level</parameter></paramdef> |
| 25 | <paramdef>GLenum <parameter>internalformat</parameter></paramdef> |
| 26 | <paramdef>GLint <parameter>x</parameter></paramdef> |
| 27 | <paramdef>GLint <parameter>y</parameter></paramdef> |
| 28 | <paramdef>GLsizei <parameter>width</parameter></paramdef> |
| 29 | <paramdef>GLsizei <parameter>height</parameter></paramdef> |
| 30 | <paramdef>GLint <parameter>border</parameter></paramdef> |
| 31 | </funcprototype> |
| 32 | </funcsynopsis> |
| 33 | </refsynopsisdiv> |
| 34 | <!-- eqn: ignoring delim $$ --> |
| 35 | <refsect1 id="parameters"><title>Parameters</title> |
| 36 | <variablelist> |
| 37 | <varlistentry> |
| 38 | <term><parameter>target</parameter></term> |
| 39 | <listitem> |
| 40 | <para> |
| 41 | Specifies the target texture. |
| 42 | Must be <constant>GL_TEXTURE_2D</constant>, |
| 43 | <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_X</constant>, |
| 44 | <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_X</constant>, |
| 45 | <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_Y</constant>, |
| 46 | <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_Y</constant>, |
| 47 | <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_Z</constant>, or |
| 48 | <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_Z</constant>. |
| 49 | </para> |
| 50 | </listitem> |
| 51 | </varlistentry> |
| 52 | <varlistentry> |
| 53 | <term><parameter>level</parameter></term> |
| 54 | <listitem> |
| 55 | <para> |
| 56 | Specifies the level-of-detail number. |
| 57 | Level 0 is the base image level. |
| 58 | Level <emphasis>n</emphasis> is the <emphasis>n</emphasis>th mipmap reduction image. |
| 59 | </para> |
| 60 | </listitem> |
| 61 | </varlistentry> |
| 62 | <varlistentry> |
| 63 | <term><parameter>internalformat</parameter></term> |
| 64 | <listitem> |
| 65 | <para> |
| 66 | Specifies the internal format of the texture. |
| 67 | Must be one of the following symbolic constants: |
| 68 | <constant>GL_COMPRESSED_RED</constant>, |
| 69 | <constant>GL_COMPRESSED_RG</constant>, |
| 70 | <constant>GL_COMPRESSED_RGB</constant>, |
| 71 | <constant>GL_COMPRESSED_RGBA</constant>. |
| 72 | <constant>GL_COMPRESSED_SRGB</constant>, |
| 73 | <constant>GL_COMPRESSED_SRGB_ALPHA</constant>. |
| 74 | <constant>GL_DEPTH_COMPONENT</constant>, |
| 75 | <constant>GL_DEPTH_COMPONENT16</constant>, |
| 76 | <constant>GL_DEPTH_COMPONENT24</constant>, |
| 77 | <constant>GL_DEPTH_COMPONENT32</constant>, |
| 78 | <constant>GL_RED</constant>, |
| 79 | <constant>GL_RG</constant>, |
| 80 | <constant>GL_RGB</constant>, |
| 81 | <constant>GL_R3_G3_B2</constant>, |
| 82 | <constant>GL_RGB4</constant>, |
| 83 | <constant>GL_RGB5</constant>, |
| 84 | <constant>GL_RGB8</constant>, |
| 85 | <constant>GL_RGB10</constant>, |
| 86 | <constant>GL_RGB12</constant>, |
| 87 | <constant>GL_RGB16</constant>, |
| 88 | <constant>GL_RGBA</constant>, |
| 89 | <constant>GL_RGBA2</constant>, |
| 90 | <constant>GL_RGBA4</constant>, |
| 91 | <constant>GL_RGB5_A1</constant>, |
| 92 | <constant>GL_RGBA8</constant>, |
| 93 | <constant>GL_RGB10_A2</constant>, |
| 94 | <constant>GL_RGBA12</constant>, |
| 95 | <constant>GL_RGBA16</constant>, |
| 96 | <constant>GL_SRGB</constant>, |
| 97 | <constant>GL_SRGB8</constant>, |
| 98 | <constant>GL_SRGB_ALPHA</constant>, or |
| 99 | <constant>GL_SRGB8_ALPHA8</constant>. |
| 100 | </para> |
| 101 | </listitem> |
| 102 | </varlistentry> |
| 103 | <varlistentry> |
| 104 | <term><parameter>x</parameter></term> |
| 105 | <term><parameter>y</parameter></term> |
| 106 | <listitem> |
| 107 | <para> |
| 108 | Specify the window coordinates of the lower left corner |
| 109 | of the rectangular region of pixels to be copied. |
| 110 | </para> |
| 111 | </listitem> |
| 112 | </varlistentry> |
| 113 | <varlistentry> |
| 114 | <term><parameter>width</parameter></term> |
| 115 | <listitem> |
| 116 | <para> |
| 117 | Specifies the width of the texture image. |
| 118 | Must be 0 or |
| 119 | <inlineequation><mml:math> |
| 120 | <!-- eqn: 2 sup n + 2 ( border ): --> |
| 121 | <mml:mrow> |
| 122 | <mml:msup><mml:mn>2</mml:mn> |
| 123 | <mml:mi mathvariant="italic">n</mml:mi> |
| 124 | </mml:msup> |
| 125 | <mml:mo>+</mml:mo> |
| 126 | <mml:mrow> |
| 127 | <mml:mn>2</mml:mn> |
| 128 | <mml:mo>⁡</mml:mo> |
| 129 | <mml:mfenced open="(" close=")"> |
| 130 | <mml:mi mathvariant="italic">border</mml:mi> |
| 131 | </mml:mfenced> |
| 132 | </mml:mrow> |
| 133 | </mml:mrow> |
| 134 | </mml:math></inlineequation> |
| 135 | for some integer |
| 136 | <inlineequation><mml:math><mml:mi mathvariant="italic">n</mml:mi></mml:math></inlineequation>. |
| 137 | </para> |
| 138 | </listitem> |
| 139 | </varlistentry> |
| 140 | <varlistentry> |
| 141 | <term><parameter>height</parameter></term> |
| 142 | <listitem> |
| 143 | <para> |
| 144 | Specifies the height of the texture image. |
| 145 | Must be 0 or |
| 146 | <inlineequation><mml:math> |
| 147 | <!-- eqn: 2 sup m + 2 ( border ): --> |
| 148 | <mml:mrow> |
| 149 | <mml:msup><mml:mn>2</mml:mn> |
| 150 | <mml:mi mathvariant="italic">m</mml:mi> |
| 151 | </mml:msup> |
| 152 | <mml:mo>+</mml:mo> |
| 153 | <mml:mrow> |
| 154 | <mml:mn>2</mml:mn> |
| 155 | <mml:mo>⁡</mml:mo> |
| 156 | <mml:mfenced open="(" close=")"> |
| 157 | <mml:mi mathvariant="italic">border</mml:mi> |
| 158 | </mml:mfenced> |
| 159 | </mml:mrow> |
| 160 | </mml:mrow> |
| 161 | </mml:math></inlineequation> |
| 162 | for some integer |
| 163 | <inlineequation><mml:math><mml:mi mathvariant="italic">m</mml:mi></mml:math></inlineequation>. |
| 164 | </para> |
| 165 | </listitem> |
| 166 | </varlistentry> |
| 167 | <varlistentry> |
| 168 | <term><parameter>border</parameter></term> |
| 169 | <listitem> |
| 170 | <para> |
| 171 | Specifies the width of the border. |
| 172 | Must be either 0 or 1. |
| 173 | </para> |
| 174 | </listitem> |
| 175 | </varlistentry> |
| 176 | </variablelist> |
| 177 | </refsect1> |
| 178 | <refsect1 id="description"><title>Description</title> |
| 179 | <para> |
| 180 | <function>glCopyTexImage2D</function> defines a two-dimensional texture image, or cube-map texture image |
| 181 | with pixels from the current |
| 182 | <constant>GL_READ_BUFFER</constant>. |
| 183 | </para> |
| 184 | <para> |
| 185 | The screen-aligned pixel rectangle with lower left corner at (<parameter>x</parameter>, |
| 186 | <parameter>y</parameter>) and with a width of |
| 187 | <inlineequation><mml:math> |
| 188 | <!-- eqn: width + 2 ( border ): --> |
| 189 | <mml:mrow> |
| 190 | <mml:mi mathvariant="italic">width</mml:mi> |
| 191 | <mml:mo>+</mml:mo> |
| 192 | <mml:mrow> |
| 193 | <mml:mn>2</mml:mn> |
| 194 | <mml:mo>⁡</mml:mo> |
| 195 | <mml:mfenced open="(" close=")"> |
| 196 | <mml:mi mathvariant="italic">border</mml:mi> |
| 197 | </mml:mfenced> |
| 198 | </mml:mrow> |
| 199 | </mml:mrow> |
| 200 | </mml:math></inlineequation> |
| 201 | and a height of |
| 202 | <inlineequation><mml:math> |
| 203 | <!-- eqn: height + 2 ( border ): --> |
| 204 | <mml:mrow> |
| 205 | <mml:mi mathvariant="italic">height</mml:mi> |
| 206 | <mml:mo>+</mml:mo> |
| 207 | <mml:mrow> |
| 208 | <mml:mn>2</mml:mn> |
| 209 | <mml:mo>⁡</mml:mo> |
| 210 | <mml:mfenced open="(" close=")"> |
| 211 | <mml:mi mathvariant="italic">border</mml:mi> |
| 212 | </mml:mfenced> |
| 213 | </mml:mrow> |
| 214 | </mml:mrow> |
| 215 | </mml:math></inlineequation> |
| 216 | defines the texture array |
| 217 | at the mipmap level specified by <parameter>level</parameter>. |
| 218 | <parameter>internalformat</parameter> specifies the internal format of the texture array. |
| 219 | </para> |
| 220 | <para> |
| 221 | The pixels in the rectangle are processed exactly as if |
| 222 | <citerefentry><refentrytitle>glReadPixels</refentrytitle></citerefentry> had been called, but the process stops just before |
| 223 | final conversion. |
| 224 | At this point all pixel component values are clamped to the range |
| 225 | <inlineequation><mml:math> |
| 226 | <!-- eqn: [0,1]: --> |
| 227 | <mml:mfenced open="[" close="]"> |
| 228 | <mml:mn>0</mml:mn> |
| 229 | <mml:mn>1</mml:mn> |
| 230 | </mml:mfenced> |
| 231 | </mml:math></inlineequation> |
| 232 | and then converted to the texture's internal format for storage in the texel |
| 233 | array. |
| 234 | </para> |
| 235 | <para> |
| 236 | Pixel ordering is such that lower |
| 237 | <inlineequation><mml:math><mml:mi mathvariant="italic">x</mml:mi></mml:math></inlineequation> |
| 238 | and |
| 239 | <inlineequation><mml:math><mml:mi mathvariant="italic">y</mml:mi></mml:math></inlineequation> |
| 240 | screen coordinates correspond to |
| 241 | lower |
| 242 | <inlineequation><mml:math><mml:mi mathvariant="italic">s</mml:mi></mml:math></inlineequation> |
| 243 | and |
| 244 | <inlineequation><mml:math><mml:mi mathvariant="italic">t</mml:mi></mml:math></inlineequation> |
| 245 | texture coordinates. |
| 246 | </para> |
| 247 | <para> |
| 248 | If any of the pixels within the specified rectangle of the current |
| 249 | <constant>GL_READ_BUFFER</constant> are outside the window associated with the current |
| 250 | rendering context, then the values obtained for those pixels are undefined. |
| 251 | </para> |
| 252 | <para> |
| 253 | When <parameter>internalformat</parameter> is one of the sRGB types, the GL does not automatically convert the source pixels to the sRGB color space. In this case, the <function>glPixelMap</function> function can be used to accomplish the conversion. |
| 254 | </para> |
| 255 | </refsect1> |
| 256 | <refsect1 id="notes"><title>Notes</title> |
| 257 | <para> |
| 258 | 1, 2, 3, and 4 are not accepted values for <parameter>internalformat</parameter>. |
| 259 | </para> |
| 260 | <para> |
| 261 | An image with height or width of 0 indicates a NULL texture. |
| 262 | </para> |
| 263 | </refsect1> |
| 264 | <refsect1 id="errors"><title>Errors</title> |
| 265 | <para> |
| 266 | <constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is not <constant>GL_TEXTURE_2D</constant>, |
| 267 | <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_X</constant>, |
| 268 | <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_X</constant>, |
| 269 | <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_Y</constant>, |
| 270 | <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_Y</constant>, |
| 271 | <constant>GL_TEXTURE_CUBE_MAP_POSITIVE_Z</constant>, or |
| 272 | <constant>GL_TEXTURE_CUBE_MAP_NEGATIVE_Z</constant>. |
| 273 | </para> |
| 274 | <para> |
| 275 | <constant>GL_INVALID_VALUE</constant> is generated if <parameter>level</parameter> is less than 0. |
| 276 | </para> |
| 277 | <para> |
| 278 | <constant>GL_INVALID_VALUE</constant> may be generated if <parameter>level</parameter> is greater |
| 279 | than |
| 280 | <inlineequation><mml:math> |
| 281 | <!-- eqn: log sub 2 max: --> |
| 282 | <mml:mrow> |
| 283 | <mml:msub><mml:mi mathvariant="italic">log</mml:mi> |
| 284 | <mml:mn>2</mml:mn> |
| 285 | </mml:msub> |
| 286 | <mml:mo>⁢</mml:mo> |
| 287 | <mml:mi mathvariant="italic">max</mml:mi> |
| 288 | </mml:mrow> |
| 289 | </mml:math></inlineequation>, |
| 290 | where |
| 291 | <inlineequation><mml:math><mml:mi mathvariant="italic">max</mml:mi></mml:math></inlineequation> |
| 292 | is the returned value of <constant>GL_MAX_TEXTURE_SIZE</constant>. |
| 293 | </para> |
| 294 | <para> |
| 295 | <constant>GL_INVALID_VALUE</constant> is generated if <parameter>width</parameter> is less than 0 |
| 296 | or greater than |
| 297 | <constant>GL_MAX_TEXTURE_SIZE</constant>. |
| 298 | </para> |
| 299 | <para> |
| 300 | <constant>GL_INVALID_VALUE</constant> is generated if non-power-of-two textures are not supported and the <parameter>width</parameter> or <parameter>depth</parameter> cannot be represented as |
| 301 | <inlineequation><mml:math> |
| 302 | <!-- eqn: 2 sup k + 2 ( border ): --> |
| 303 | <mml:mrow> |
| 304 | <mml:msup><mml:mn>2</mml:mn> |
| 305 | <mml:mi mathvariant="italic">k</mml:mi> |
| 306 | </mml:msup> |
| 307 | <mml:mo>+</mml:mo> |
| 308 | <mml:mrow> |
| 309 | <mml:mn>2</mml:mn> |
| 310 | <mml:mo>⁡</mml:mo> |
| 311 | <mml:mfenced open="(" close=")"> |
| 312 | <mml:mi mathvariant="italic">border</mml:mi> |
| 313 | </mml:mfenced> |
| 314 | </mml:mrow> |
| 315 | </mml:mrow> |
| 316 | </mml:math></inlineequation> |
| 317 | for some integer |
| 318 | <inlineequation><mml:math><mml:mi mathvariant="italic">k</mml:mi></mml:math></inlineequation>. |
| 319 | </para> |
| 320 | <para> |
| 321 | <constant>GL_INVALID_VALUE</constant> is generated if <parameter>border</parameter> is not 0 or 1. |
| 322 | </para> |
| 323 | <para> |
| 324 | <constant>GL_INVALID_VALUE</constant> is generated if <parameter>internalformat</parameter> is not an |
| 325 | accepted format. |
| 326 | </para> |
| 327 | <para> |
| 328 | <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>internalformat</parameter> is |
| 329 | <constant>GL_DEPTH_COMPONENT</constant>, <constant>GL_DEPTH_COMPONENT16</constant>, |
| 330 | <constant>GL_DEPTH_COMPONENT24</constant>, or <constant>GL_DEPTH_COMPONENT32</constant> and there is no depth |
| 331 | buffer. |
| 332 | </para> |
| 333 | </refsect1> |
| 334 | <refsect1 id="associatedgets"><title>Associated Gets</title> |
| 335 | <para> |
| 336 | <citerefentry><refentrytitle>glGetTexImage</refentrytitle></citerefentry> |
| 337 | </para> |
| 338 | </refsect1> |
| 339 | <refsect1 id="seealso"><title>See Also</title> |
| 340 | <para> |
| 341 | <citerefentry><refentrytitle>glCopyTexImage1D</refentrytitle></citerefentry>, |
| 342 | <citerefentry><refentrytitle>glCopyTexSubImage1D</refentrytitle></citerefentry>, |
| 343 | <citerefentry><refentrytitle>glCopyTexSubImage2D</refentrytitle></citerefentry>, |
| 344 | <citerefentry><refentrytitle>glPixelStore</refentrytitle></citerefentry>, |
| 345 | <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry>, |
| 346 | <citerefentry><refentrytitle>glTexImage2D</refentrytitle></citerefentry>, |
| 347 | <citerefentry><refentrytitle>glTexSubImage1D</refentrytitle></citerefentry>, |
| 348 | <citerefentry><refentrytitle>glTexSubImage2D</refentrytitle></citerefentry>, |
| 349 | <citerefentry><refentrytitle>glTexParameter</refentrytitle></citerefentry> |
| 350 | </para> |
| 351 | </refsect1> |
| 352 | <refsect1 id="Copyright"><title>Copyright</title> |
| 353 | <para> |
| 354 | Copyright <trademark class="copyright"></trademark> 1991-2006 |
| 355 | Silicon Graphics, Inc. This document is licensed under the SGI |
| 356 | Free Software B License. For details, see |
| 357 | <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>. |
| 358 | </para> |
| 359 | </refsect1> |
| 360 | </refentry> |