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>glCopyTexImage2D - 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="glCopyTexImage2D"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glCopyTexImage2D — copy pixels into a 2D texture image</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">glCopyTexImage2D</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>GLenum </td><td><var class="pdparam">internalformat</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>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">border</var><code>)</code>;</td></tr></table></div></div><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> | |
5 | Specifies the target texture. | |
6 | Must be <code class="constant">GL_TEXTURE_2D</code>, | |
7 | <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_X</code>, | |
8 | <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_X</code>, | |
9 | <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_Y</code>, | |
10 | <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_Y</code>, | |
11 | <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_Z</code>, or | |
12 | <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_Z</code>. | |
13 | </p></dd><dt><span class="term"><em class="parameter"><code>level</code></em></span></dt><dd><p> | |
14 | Specifies the level-of-detail number. | |
15 | Level 0 is the base image level. | |
16 | Level <span class="emphasis"><em>n</em></span> is the <span class="emphasis"><em>n</em></span>th mipmap reduction image. | |
17 | </p></dd><dt><span class="term"><em class="parameter"><code>internalformat</code></em></span></dt><dd><p> | |
18 | Specifies the internal format of the texture. | |
19 | Must be one of the following symbolic constants: | |
20 | <code class="constant">GL_COMPRESSED_RED</code>, | |
21 | <code class="constant">GL_COMPRESSED_RG</code>, | |
22 | <code class="constant">GL_COMPRESSED_RGB</code>, | |
23 | <code class="constant">GL_COMPRESSED_RGBA</code>. | |
24 | <code class="constant">GL_COMPRESSED_SRGB</code>, | |
25 | <code class="constant">GL_COMPRESSED_SRGB_ALPHA</code>. | |
26 | <code class="constant">GL_DEPTH_COMPONENT</code>, | |
27 | <code class="constant">GL_DEPTH_COMPONENT16</code>, | |
28 | <code class="constant">GL_DEPTH_COMPONENT24</code>, | |
29 | <code class="constant">GL_DEPTH_COMPONENT32</code>, | |
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_R3_G3_B2</code>, | |
34 | <code class="constant">GL_RGB4</code>, | |
35 | <code class="constant">GL_RGB5</code>, | |
36 | <code class="constant">GL_RGB8</code>, | |
37 | <code class="constant">GL_RGB10</code>, | |
38 | <code class="constant">GL_RGB12</code>, | |
39 | <code class="constant">GL_RGB16</code>, | |
40 | <code class="constant">GL_RGBA</code>, | |
41 | <code class="constant">GL_RGBA2</code>, | |
42 | <code class="constant">GL_RGBA4</code>, | |
43 | <code class="constant">GL_RGB5_A1</code>, | |
44 | <code class="constant">GL_RGBA8</code>, | |
45 | <code class="constant">GL_RGB10_A2</code>, | |
46 | <code class="constant">GL_RGBA12</code>, | |
47 | <code class="constant">GL_RGBA16</code>, | |
48 | <code class="constant">GL_SRGB</code>, | |
49 | <code class="constant">GL_SRGB8</code>, | |
50 | <code class="constant">GL_SRGB_ALPHA</code>, or | |
51 | <code class="constant">GL_SRGB8_ALPHA8</code>. | |
52 | </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> | |
53 | Specify the window coordinates of the lower left corner | |
54 | of the rectangular region of pixels to be copied. | |
55 | </p></dd><dt><span class="term"><em class="parameter"><code>width</code></em></span></dt><dd><p> | |
56 | Specifies the width of the texture image. | |
57 | Must be 0 or | |
58 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
59 | ||
60 | <mml:mrow> | |
61 | <mml:msup><mml:mn>2</mml:mn> | |
62 | <mml:mi mathvariant="italic">n</mml:mi> | |
63 | </mml:msup> | |
64 | <mml:mo>+</mml:mo> | |
65 | <mml:mrow> | |
66 | <mml:mn>2</mml:mn> | |
67 | <mml:mo></mml:mo> | |
68 | <mml:mfenced open="(" close=")"> | |
69 | <mml:mi mathvariant="italic">border</mml:mi> | |
70 | </mml:mfenced> | |
71 | </mml:mrow> | |
72 | </mml:mrow> | |
73 | </mml:math> | |
74 | for some integer | |
75 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">n</mml:mi></mml:math>. | |
76 | </p></dd><dt><span class="term"><em class="parameter"><code>height</code></em></span></dt><dd><p> | |
77 | Specifies the height of the texture image. | |
78 | Must be 0 or | |
79 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
80 | ||
81 | <mml:mrow> | |
82 | <mml:msup><mml:mn>2</mml:mn> | |
83 | <mml:mi mathvariant="italic">m</mml:mi> | |
84 | </mml:msup> | |
85 | <mml:mo>+</mml:mo> | |
86 | <mml:mrow> | |
87 | <mml:mn>2</mml:mn> | |
88 | <mml:mo></mml:mo> | |
89 | <mml:mfenced open="(" close=")"> | |
90 | <mml:mi mathvariant="italic">border</mml:mi> | |
91 | </mml:mfenced> | |
92 | </mml:mrow> | |
93 | </mml:mrow> | |
94 | </mml:math> | |
95 | for some integer | |
96 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">m</mml:mi></mml:math>. | |
97 | </p></dd><dt><span class="term"><em class="parameter"><code>border</code></em></span></dt><dd><p> | |
98 | Specifies the width of the border. | |
99 | Must be either 0 or 1. | |
100 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> | |
101 | <code class="function">glCopyTexImage2D</code> defines a two-dimensional texture image, or cube-map texture image | |
102 | with pixels from the current | |
103 | <code class="constant">GL_READ_BUFFER</code>. | |
104 | </p><p> | |
105 | The screen-aligned pixel rectangle with lower left corner at (<em class="parameter"><code>x</code></em>, | |
106 | <em class="parameter"><code>y</code></em>) and with a width of | |
107 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
108 | ||
109 | <mml:mrow> | |
110 | <mml:mi mathvariant="italic">width</mml:mi> | |
111 | <mml:mo>+</mml:mo> | |
112 | <mml:mrow> | |
113 | <mml:mn>2</mml:mn> | |
114 | <mml:mo></mml:mo> | |
115 | <mml:mfenced open="(" close=")"> | |
116 | <mml:mi mathvariant="italic">border</mml:mi> | |
117 | </mml:mfenced> | |
118 | </mml:mrow> | |
119 | </mml:mrow> | |
120 | </mml:math> | |
121 | and a height of | |
122 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
123 | ||
124 | <mml:mrow> | |
125 | <mml:mi mathvariant="italic">height</mml:mi> | |
126 | <mml:mo>+</mml:mo> | |
127 | <mml:mrow> | |
128 | <mml:mn>2</mml:mn> | |
129 | <mml:mo></mml:mo> | |
130 | <mml:mfenced open="(" close=")"> | |
131 | <mml:mi mathvariant="italic">border</mml:mi> | |
132 | </mml:mfenced> | |
133 | </mml:mrow> | |
134 | </mml:mrow> | |
135 | </mml:math> | |
136 | defines the texture array | |
137 | at the mipmap level specified by <em class="parameter"><code>level</code></em>. | |
138 | <em class="parameter"><code>internalformat</code></em> specifies the internal format of the texture array. | |
139 | </p><p> | |
140 | The pixels in the rectangle are processed exactly as if | |
141 | <a href="glReadPixels.xml"><span class="citerefentry"><span class="refentrytitle">glReadPixels</span></span></a> had been called, but the process stops just before | |
142 | final conversion. | |
143 | At this point all pixel component values are clamped to the range | |
144 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
145 | ||
146 | <mml:mfenced open="[" close="]"> | |
147 | <mml:mn>0</mml:mn> | |
148 | <mml:mn>1</mml:mn> | |
149 | </mml:mfenced> | |
150 | </mml:math> | |
151 | and then converted to the texture's internal format for storage in the texel | |
152 | array. | |
153 | </p><p> | |
154 | Pixel ordering is such that lower | |
155 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">x</mml:mi></mml:math> | |
156 | and | |
157 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">y</mml:mi></mml:math> | |
158 | screen coordinates correspond to | |
159 | lower | |
160 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">s</mml:mi></mml:math> | |
161 | and | |
162 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">t</mml:mi></mml:math> | |
163 | texture coordinates. | |
164 | </p><p> | |
165 | If any of the pixels within the specified rectangle of the current | |
166 | <code class="constant">GL_READ_BUFFER</code> are outside the window associated with the current | |
167 | rendering context, then the values obtained for those pixels are undefined. | |
168 | </p><p> | |
169 | When <em class="parameter"><code>internalformat</code></em> is one of the sRGB types, the GL does not automatically convert the source pixels to the sRGB color space. In this case, the <code class="function">glPixelMap</code> function can be used to accomplish the conversion. | |
170 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p> | |
171 | 1, 2, 3, and 4 are not accepted values for <em class="parameter"><code>internalformat</code></em>. | |
172 | </p><p> | |
173 | An image with height or width of 0 indicates a NULL texture. | |
174 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p> | |
175 | <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>, | |
176 | <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_X</code>, | |
177 | <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_X</code>, | |
178 | <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_Y</code>, | |
179 | <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_Y</code>, | |
180 | <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_Z</code>, or | |
181 | <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_Z</code>. | |
182 | </p><p> | |
183 | <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>level</code></em> is less than 0. | |
184 | </p><p> | |
185 | <code class="constant">GL_INVALID_VALUE</code> may be generated if <em class="parameter"><code>level</code></em> is greater | |
186 | than | |
187 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
188 | ||
189 | <mml:mrow> | |
190 | <mml:msub><mml:mi mathvariant="italic">log</mml:mi> | |
191 | <mml:mn>2</mml:mn> | |
192 | </mml:msub> | |
193 | <mml:mo></mml:mo> | |
194 | <mml:mi mathvariant="italic">max</mml:mi> | |
195 | </mml:mrow> | |
196 | </mml:math>, | |
197 | where | |
198 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">max</mml:mi></mml:math> | |
199 | is the returned value of <code class="constant">GL_MAX_TEXTURE_SIZE</code>. | |
200 | </p><p> | |
201 | <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>width</code></em> is less than 0 | |
202 | or greater than | |
203 | <code class="constant">GL_MAX_TEXTURE_SIZE</code>. | |
204 | </p><p> | |
205 | <code class="constant">GL_INVALID_VALUE</code> is generated if non-power-of-two textures are not supported and the <em class="parameter"><code>width</code></em> or <em class="parameter"><code>depth</code></em> cannot be represented as | |
206 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
207 | ||
208 | <mml:mrow> | |
209 | <mml:msup><mml:mn>2</mml:mn> | |
210 | <mml:mi mathvariant="italic">k</mml:mi> | |
211 | </mml:msup> | |
212 | <mml:mo>+</mml:mo> | |
213 | <mml:mrow> | |
214 | <mml:mn>2</mml:mn> | |
215 | <mml:mo></mml:mo> | |
216 | <mml:mfenced open="(" close=")"> | |
217 | <mml:mi mathvariant="italic">border</mml:mi> | |
218 | </mml:mfenced> | |
219 | </mml:mrow> | |
220 | </mml:mrow> | |
221 | </mml:math> | |
222 | for some integer | |
223 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">k</mml:mi></mml:math>. | |
224 | </p><p> | |
225 | <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>border</code></em> is not 0 or 1. | |
226 | </p><p> | |
227 | <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>internalformat</code></em> is not an | |
228 | accepted format. | |
229 | </p><p> | |
230 | <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>internalformat</code></em> is | |
231 | <code class="constant">GL_DEPTH_COMPONENT</code>, <code class="constant">GL_DEPTH_COMPONENT16</code>, | |
232 | <code class="constant">GL_DEPTH_COMPONENT24</code>, or <code class="constant">GL_DEPTH_COMPONENT32</code> and there is no depth | |
233 | buffer. | |
234 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p> | |
235 | <a href="glGetTexImage.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexImage</span></span></a> | |
236 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> | |
237 | <a href="glCopyTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage1D</span></span></a>, | |
238 | <a href="glCopyTexSubImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage1D</span></span></a>, | |
239 | <a href="glCopyTexSubImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage2D</span></span></a>, | |
240 | <a href="glPixelStore.xml"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a>, | |
241 | <a href="glTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a>, | |
242 | <a href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>, | |
243 | <a href="glTexSubImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage1D</span></span></a>, | |
244 | <a href="glTexSubImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage2D</span></span></a>, | |
245 | <a href="glTexParameter.xml"><span class="citerefentry"><span class="refentrytitle">glTexParameter</span></span></a> | |
246 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
247 | Copyright <span class="trademark"></span>© 1991-2006 | |
248 | Silicon Graphics, Inc. This document is licensed under the SGI | |
249 | Free Software B License. For details, see | |
250 | <a href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>. | |
251 | </p></div></div></body></html> |