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>glGetTexImage - 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="glGetTexImage"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glGetTexImage — return a 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">glGetTexImage</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">format</var>, </td></tr><tr><td> </td><td>GLenum </td><td><var class="pdparam">type</var>, </td></tr><tr><td> </td><td>GLvoid * </td><td><var class="pdparam">img</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 which texture is to be obtained. | |
6 | <code class="constant">GL_TEXTURE_1D</code>, | |
7 | <code class="constant">GL_TEXTURE_2D</code>, | |
8 | <code class="constant">GL_TEXTURE_3D</code>, | |
9 | <code class="constant">GL_TEXTURE_1D_ARRAY</code>, | |
10 | <code class="constant">GL_TEXTURE_2D_ARRAY</code>, | |
11 | <code class="constant">GL_TEXTURE_RECTANGLE</code>, | |
12 | <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_X</code>, | |
13 | <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_X</code>, | |
14 | <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_Y</code>, | |
15 | <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_Y</code>, | |
16 | <code class="constant">GL_TEXTURE_CUBE_MAP_POSITIVE_Z</code>, and | |
17 | <code class="constant">GL_TEXTURE_CUBE_MAP_NEGATIVE_Z</code> | |
18 | are accepted. | |
19 | </p></dd><dt><span class="term"><em class="parameter"><code>level</code></em></span></dt><dd><p> | |
20 | Specifies the level-of-detail number of the desired image. | |
21 | Level 0 is the base image level. | |
22 | Level | |
23 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">n</mml:mi></mml:math> | |
24 | is the | |
25 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">n</mml:mi></mml:math>th | |
26 | mipmap reduction image. | |
27 | </p></dd><dt><span class="term"><em class="parameter"><code>format</code></em></span></dt><dd><p> | |
28 | Specifies a pixel format for the returned data. | |
29 | The supported formats are | |
30 | <code class="constant">GL_STENCIL_INDEX</code>, | |
31 | <code class="constant">GL_DEPTH_COMPONENT</code>, | |
32 | <code class="constant">GL_DEPTH_STENCIL</code>, | |
33 | <code class="constant">GL_RED</code>, | |
34 | <code class="constant">GL_GREEN</code>, | |
35 | <code class="constant">GL_BLUE</code>, | |
36 | <code class="constant">GL_RG</code>, | |
37 | <code class="constant">GL_RGB</code>, | |
38 | <code class="constant">GL_RGBA</code>, | |
39 | <code class="constant">GL_BGR</code>, | |
40 | <code class="constant">GL_BGRA</code>, | |
41 | <code class="constant">GL_RED_INTEGER</code>, | |
42 | <code class="constant">GL_GREEN_INTEGER</code>, | |
43 | <code class="constant">GL_BLUE_INTEGER</code>, | |
44 | <code class="constant">GL_RG_INTEGER</code>, | |
45 | <code class="constant">GL_RGB_INTEGER</code>, | |
46 | <code class="constant">GL_RGBA_INTEGER</code>, | |
47 | <code class="constant">GL_BGR_INTEGER</code>, | |
48 | <code class="constant">GL_BGRA_INTEGER</code>. | |
49 | </p></dd><dt><span class="term"><em class="parameter"><code>type</code></em></span></dt><dd><p> | |
50 | Specifies a pixel type for the returned data. | |
51 | The supported types are | |
52 | <code class="constant">GL_UNSIGNED_BYTE</code>, | |
53 | <code class="constant">GL_BYTE</code>, | |
54 | <code class="constant">GL_UNSIGNED_SHORT</code>, | |
55 | <code class="constant">GL_SHORT</code>, | |
56 | <code class="constant">GL_UNSIGNED_INT</code>, | |
57 | <code class="constant">GL_INT</code>, | |
58 | <code class="constant">GL_HALF_FLOAT</code>, | |
59 | <code class="constant">GL_FLOAT</code>, | |
60 | <code class="constant">GL_UNSIGNED_BYTE_3_3_2</code>, | |
61 | <code class="constant">GL_UNSIGNED_BYTE_2_3_3_REV</code>, | |
62 | <code class="constant">GL_UNSIGNED_SHORT_5_6_5</code>, | |
63 | <code class="constant">GL_UNSIGNED_SHORT_5_6_5_REV</code>, | |
64 | <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4</code>, | |
65 | <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4_REV</code>, | |
66 | <code class="constant">GL_UNSIGNED_SHORT_5_5_5_1</code>, | |
67 | <code class="constant">GL_UNSIGNED_SHORT_1_5_5_5_REV</code>, | |
68 | <code class="constant">GL_UNSIGNED_INT_8_8_8_8</code>, | |
69 | <code class="constant">GL_UNSIGNED_INT_8_8_8_8_REV</code>, | |
70 | <code class="constant">GL_UNSIGNED_INT_10_10_10_2</code>, | |
71 | <code class="constant">GL_UNSIGNED_INT_2_10_10_10_REV</code>, | |
72 | <code class="constant">GL_UNSIGNED_INT_24_8</code>, | |
73 | <code class="constant">GL_UNSIGNED_INT_10F_11F_11F_REV</code>, | |
74 | <code class="constant">GL_UNSIGNED_INT_5_9_9_9_REV</code>, and | |
75 | <code class="constant">GL_FLOAT_32_UNSIGNED_INT_24_8_REV</code>. | |
76 | </p></dd><dt><span class="term"><em class="parameter"><code>img</code></em></span></dt><dd><p> | |
77 | Returns the texture image. | |
78 | Should be a pointer to an array of the type specified by <em class="parameter"><code>type</code></em>. | |
79 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> | |
80 | <code class="function">glGetTexImage</code> returns a texture image into <em class="parameter"><code>img</code></em>. | |
81 | <em class="parameter"><code>target</code></em> specifies whether the desired texture image is one specified by | |
82 | <a href="glTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a> (<code class="constant">GL_TEXTURE_1D</code>), | |
83 | <a href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a> (<code class="constant">GL_TEXTURE_1D_ARRAY</code>, <code class="constant">GL_TEXTURE_RECTANGLE</code>, | |
84 | <code class="constant">GL_TEXTURE_2D</code> or any of | |
85 | <code class="constant">GL_TEXTURE_CUBE_MAP_*</code>), | |
86 | or | |
87 | <a href="glTexImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage3D</span></span></a> (<code class="constant">GL_TEXTURE_2D_ARRAY</code>, | |
88 | <code class="constant">GL_TEXTURE_3D</code>). | |
89 | <em class="parameter"><code>level</code></em> specifies the level-of-detail number of the desired image. | |
90 | <em class="parameter"><code>format</code></em> and <em class="parameter"><code>type</code></em> specify the format and type of the desired image array. | |
91 | See the reference page for <a href="glTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a> | |
92 | for a description of the acceptable values for the <em class="parameter"><code>format</code></em> and <em class="parameter"><code>type</code></em> | |
93 | parameters, respectively. | |
94 | </p><p> | |
95 | If a non-zero named buffer object is bound to the <code class="constant">GL_PIXEL_PACK_BUFFER</code> target | |
96 | (see <a href="glBindBuffer.xml"><span class="citerefentry"><span class="refentrytitle">glBindBuffer</span></span></a>) while a texture image is | |
97 | requested, <em class="parameter"><code>img</code></em> is treated as a byte offset into the buffer object's data store. | |
98 | </p><p> | |
99 | To understand the operation of <code class="function">glGetTexImage</code>, consider the selected internal | |
100 | four-component texture image to be an RGBA color buffer the size of the image. | |
101 | The semantics of <code class="function">glGetTexImage</code> are then identical to those of <a href="glReadPixels.xml"><span class="citerefentry"><span class="refentrytitle">glReadPixels</span></span></a>, | |
102 | with the exception that no pixel transfer operations are performed, | |
103 | when called with the same <em class="parameter"><code>format</code></em> and <em class="parameter"><code>type</code></em>, | |
104 | with <span class="emphasis"><em>x</em></span> and <span class="emphasis"><em>y</em></span> set to 0, | |
105 | <span class="emphasis"><em>width</em></span> set to the width of the texture image | |
106 | and <span class="emphasis"><em>height</em></span> set to 1 for 1D images, | |
107 | or to the height of the texture image | |
108 | for 2D images. | |
109 | </p><p> | |
110 | If the selected texture image does not contain four components, | |
111 | the following mappings are applied. | |
112 | Single-component textures are treated as RGBA buffers with red set | |
113 | to the single-component value, | |
114 | green set to 0, blue set to 0, and alpha set to 1. | |
115 | Two-component textures are treated as RGBA buffers with red set to | |
116 | the value of component zero, | |
117 | alpha set to the value of component one, | |
118 | and green and blue set to 0. | |
119 | Finally, | |
120 | three-component textures are treated as RGBA buffers with red set to | |
121 | component zero, | |
122 | green set to component one, | |
123 | blue set to component two, | |
124 | and alpha set to 1. | |
125 | </p><p> | |
126 | To determine the required size of <em class="parameter"><code>img</code></em>, | |
127 | use <a href="glGetTexLevelParameter.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexLevelParameter</span></span></a> to determine the dimensions of the | |
128 | internal texture image, | |
129 | then scale the required number of pixels by the storage required for | |
130 | each pixel, | |
131 | based on <em class="parameter"><code>format</code></em> and <em class="parameter"><code>type</code></em>. | |
132 | Be sure to take the pixel storage parameters into account, | |
133 | especially <code class="constant">GL_PACK_ALIGNMENT</code>. | |
134 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p> | |
135 | If an error is generated, | |
136 | no change is made to the contents of <em class="parameter"><code>img</code></em>. | |
137 | </p><p> | |
138 | <code class="function">glGetTexImage</code> returns the texture image for the active texture unit. | |
139 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p> | |
140 | <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>target</code></em>, <em class="parameter"><code>format</code></em>, or <em class="parameter"><code>type</code></em> is not | |
141 | an accepted value. | |
142 | </p><p> | |
143 | <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>level</code></em> is less than 0. | |
144 | </p><p> | |
145 | <code class="constant">GL_INVALID_VALUE</code> may be generated if <em class="parameter"><code>level</code></em> is greater | |
146 | than | |
147 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
148 | ||
149 | <mml:mrow> | |
150 | <mml:msub><mml:mi mathvariant="italic">log</mml:mi> | |
151 | <mml:mn>2</mml:mn> | |
152 | </mml:msub> | |
153 | <mml:mo></mml:mo> | |
154 | <mml:mfenced open="(" close=")"> | |
155 | <mml:mi mathvariant="italic">max</mml:mi> | |
156 | </mml:mfenced> | |
157 | </mml:mrow> | |
158 | </mml:math>, | |
159 | where | |
160 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">max</mml:mi></mml:math> | |
161 | is the returned value of <code class="constant">GL_MAX_TEXTURE_SIZE</code>. | |
162 | </p><p> | |
163 | <code class="constant">GL_INVALID_OPERATION</code> is returned if <em class="parameter"><code>type</code></em> is one of | |
164 | <code class="constant">GL_UNSIGNED_BYTE_3_3_2</code>, | |
165 | <code class="constant">GL_UNSIGNED_BYTE_2_3_3_REV</code>, | |
166 | <code class="constant">GL_UNSIGNED_SHORT_5_6_5</code>, | |
167 | <code class="constant">GL_UNSIGNED_SHORT_5_6_5_REV</code>, or | |
168 | <code class="constant">GL_UNSIGNED_INT_10F_11F_11F_REV</code> and <em class="parameter"><code>format</code></em> is not <code class="constant">GL_RGB</code>. | |
169 | </p><p> | |
170 | <code class="constant">GL_INVALID_OPERATION</code> is returned if <em class="parameter"><code>type</code></em> is one of | |
171 | <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4</code>, | |
172 | <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4_REV</code>, | |
173 | <code class="constant">GL_UNSIGNED_SHORT_5_5_5_1</code>, | |
174 | <code class="constant">GL_UNSIGNED_SHORT_1_5_5_5_REV</code>, | |
175 | <code class="constant">GL_UNSIGNED_INT_8_8_8_8</code>, | |
176 | <code class="constant">GL_UNSIGNED_INT_8_8_8_8_REV</code>, | |
177 | <code class="constant">GL_UNSIGNED_INT_10_10_10_2</code>, | |
178 | <code class="constant">GL_UNSIGNED_INT_2_10_10_10_REV</code>, or | |
179 | <code class="constant">GL_UNSIGNED_INT_5_9_9_9_REV</code> and <em class="parameter"><code>format</code></em> is neither <code class="constant">GL_RGBA</code> | |
180 | or <code class="constant">GL_BGRA</code>. | |
181 | </p><p> | |
182 | <code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to the | |
183 | <code class="constant">GL_PIXEL_PACK_BUFFER</code> target and the buffer object's data store is currently mapped. | |
184 | </p><p> | |
185 | <code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to the | |
186 | <code class="constant">GL_PIXEL_PACK_BUFFER</code> target and the data would be packed to the buffer | |
187 | object such that the memory writes required would exceed the data store size. | |
188 | </p><p> | |
189 | <code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to the | |
190 | <code class="constant">GL_PIXEL_PACK_BUFFER</code> target and <em class="parameter"><code>img</code></em> is not evenly divisible | |
191 | into the number of bytes needed to store in memory a datum indicated by <em class="parameter"><code>type</code></em>. | |
192 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p> | |
193 | <a href="glGetTexLevelParameter.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexLevelParameter</span></span></a> with argument <code class="constant">GL_TEXTURE_WIDTH</code> | |
194 | </p><p> | |
195 | <a href="glGetTexLevelParameter.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexLevelParameter</span></span></a> with argument <code class="constant">GL_TEXTURE_HEIGHT</code> | |
196 | </p><p> | |
197 | <a href="glGetTexLevelParameter.xml"><span class="citerefentry"><span class="refentrytitle">glGetTexLevelParameter</span></span></a> with argument <code class="constant">GL_TEXTURE_INTERNAL_FORMAT</code> | |
198 | </p><p> | |
199 | <a href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with arguments <code class="constant">GL_PACK_ALIGNMENT</code> and others | |
200 | </p><p> | |
201 | <a href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_PIXEL_PACK_BUFFER_BINDING</code> | |
202 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> | |
203 | <a href="glActiveTexture.xml"><span class="citerefentry"><span class="refentrytitle">glActiveTexture</span></span></a>, | |
204 | <a href="glReadPixels.xml"><span class="citerefentry"><span class="refentrytitle">glReadPixels</span></span></a>, | |
205 | <a href="glTexImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a>, | |
206 | <a href="glTexImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>, | |
207 | <a href="glTexImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexImage3D</span></span></a>, | |
208 | <a href="glTexSubImage1D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage1D</span></span></a>, | |
209 | <a href="glTexSubImage2D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage2D</span></span></a>, | |
210 | <a href="glTexSubImage3D.xml"><span class="citerefentry"><span class="refentrytitle">glTexSubImage3D</span></span></a>, | |
211 | <a href="glTexParameter.xml"><span class="citerefentry"><span class="refentrytitle">glTexParameter</span></span></a> | |
212 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
213 | Copyright <span class="trademark"></span>© 1991-2006 | |
214 | Silicon Graphics, Inc. Copyright <span class="trademark"></span>© 2010 | |
215 | Khronos Group. This document is licensed under the SGI | |
216 | Free Software B License. For details, see | |
217 | <a href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>. | |
218 | </p></div></div></body></html> |