Revert "update upstream sources"
[clinton/guile-figl.git] / upstream-doc / man4 / xhtml / glReadPixels.xml
CommitLineData
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>glReadPixels - 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="glReadPixels"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glReadPixels — read a block of pixels from the frame buffer</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">glReadPixels</b>(</code></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>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">data</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>x</code></em>, </span><span class="term"><em class="parameter"><code>y</code></em></span></dt><dd><p>
5 Specify the window coordinates of the first pixel
6 that is read from the frame buffer.
7 This location is the lower left corner of a rectangular block of pixels.
8 </p></dd><dt><span class="term"><em class="parameter"><code>width</code></em>, </span><span class="term"><em class="parameter"><code>height</code></em></span></dt><dd><p>
9 Specify the dimensions of the pixel rectangle.
10 <em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em> of one correspond to a single pixel.
11 </p></dd><dt><span class="term"><em class="parameter"><code>format</code></em></span></dt><dd><p>
12 Specifies the format of the pixel data.
13 The following symbolic values are accepted:
14 <code class="constant">GL_STENCIL_INDEX</code>,
15 <code class="constant">GL_DEPTH_COMPONENT</code>,
16 <code class="constant">GL_DEPTH_STENCIL</code>,
17 <code class="constant">GL_RED</code>,
18 <code class="constant">GL_GREEN</code>,
19 <code class="constant">GL_BLUE</code>,
20 <code class="constant">GL_RGB</code>,
21 <code class="constant">GL_BGR</code>,
22 <code class="constant">GL_RGBA</code>, and
23 <code class="constant">GL_BGRA</code>.
24 </p></dd><dt><span class="term"><em class="parameter"><code>type</code></em></span></dt><dd><p>
25 Specifies the data type of the pixel data.
26 Must be one of
27 <code class="constant">GL_UNSIGNED_BYTE</code>,
28 <code class="constant">GL_BYTE</code>,
29 <code class="constant">GL_UNSIGNED_SHORT</code>,
30 <code class="constant">GL_SHORT</code>,
31 <code class="constant">GL_UNSIGNED_INT</code>,
32 <code class="constant">GL_INT</code>,
33 <code class="constant">GL_HALF_FLOAT</code>,
34 <code class="constant">GL_FLOAT</code>,
35 <code class="constant">GL_UNSIGNED_BYTE_3_3_2</code>,
36 <code class="constant">GL_UNSIGNED_BYTE_2_3_3_REV</code>,
37 <code class="constant">GL_UNSIGNED_SHORT_5_6_5</code>,
38 <code class="constant">GL_UNSIGNED_SHORT_5_6_5_REV</code>,
39 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4</code>,
40 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4_REV</code>,
41 <code class="constant">GL_UNSIGNED_SHORT_5_5_5_1</code>,
42 <code class="constant">GL_UNSIGNED_SHORT_1_5_5_5_REV</code>,
43 <code class="constant">GL_UNSIGNED_INT_8_8_8_8</code>,
44 <code class="constant">GL_UNSIGNED_INT_8_8_8_8_REV</code>,
45 <code class="constant">GL_UNSIGNED_INT_10_10_10_2</code>,
46 <code class="constant">GL_UNSIGNED_INT_2_10_10_10_REV</code>,
47 <code class="constant">GL_UNSIGNED_INT_24_8</code>,
48 <code class="constant">GL_UNSIGNED_INT_10F_11F_11F_REV</code>,
49 <code class="constant">GL_UNSIGNED_INT_5_9_9_9_REV</code>, or
50 <code class="constant">GL_FLOAT_32_UNSIGNED_INT_24_8_REV</code>.
51 </p></dd><dt><span class="term"><em class="parameter"><code>data</code></em></span></dt><dd><p>
52 Returns the pixel data.
53 </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
54 <code class="function">glReadPixels</code> returns pixel data from the frame buffer,
55 starting with the pixel whose lower left corner
56 is at location (<em class="parameter"><code>x</code></em>, <em class="parameter"><code>y</code></em>),
57 into client memory starting at location <em class="parameter"><code>data</code></em>.
58 Several parameters control the processing of the pixel data before
59 it is placed into client memory.
60 These parameters are set with <a href="glPixelStore.xml"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a>.
61 This reference page describes the effects on <code class="function">glReadPixels</code> of most,
62 but not all of the parameters specified by these three commands.
63 </p><p>
64 If a non-zero named buffer object is bound to the <code class="constant">GL_PIXEL_PACK_BUFFER</code> target
65 (see <a href="glBindBuffer.xml"><span class="citerefentry"><span class="refentrytitle">glBindBuffer</span></span></a>) while a block of pixels is
66 requested, <em class="parameter"><code>data</code></em> is treated as a byte offset into the buffer object's data store
67 rather than a pointer to client memory.
68 </p><p>
69 <code class="function">glReadPixels</code> returns values from each pixel with lower left corner at
70 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
71
72 <mml:mfenced open="(" close=")">
73 <mml:mrow>
74 <mml:mi mathvariant="italic">x</mml:mi>
75 <mml:mo>+</mml:mo>
76 <mml:mi mathvariant="italic">i</mml:mi>
77 </mml:mrow>
78 <mml:mrow>
79 <mml:mi mathvariant="italic">y</mml:mi>
80 <mml:mo>+</mml:mo>
81 <mml:mi mathvariant="italic">j</mml:mi>
82 </mml:mrow>
83 </mml:mfenced>
84 </mml:math>
85 for
86 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
87
88 <mml:mrow>
89 <mml:mn>0</mml:mn>
90 <mml:mo>&lt;=</mml:mo>
91 <mml:mi mathvariant="italic">i</mml:mi>
92 <mml:mo>&lt;</mml:mo>
93 <mml:mi mathvariant="italic">width</mml:mi>
94 </mml:mrow>
95 </mml:math>
96 and
97 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
98
99 <mml:mrow>
100 <mml:mn>0</mml:mn>
101 <mml:mo>&lt;=</mml:mo>
102 <mml:mi mathvariant="italic">j</mml:mi>
103 <mml:mo>&lt;</mml:mo>
104 <mml:mi mathvariant="italic">height</mml:mi>
105 </mml:mrow>
106 </mml:math>.
107 This pixel is said to be the
108 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">i</mml:mi></mml:math>th
109 pixel in the
110 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">j</mml:mi></mml:math>th
111 row.
112 Pixels are returned in row order from the lowest to the highest row,
113 left to right in each row.
114 </p><p>
115 <em class="parameter"><code>format</code></em> specifies the format for the returned pixel values;
116 accepted values are:
117 </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_STENCIL_INDEX</code></span></dt><dd><p>
118 Stencil values are read from the stencil buffer.
f37e7e3d
DH
119 Each index is converted to fixed point,
120 shifted left or right depending on the value and sign of <code class="constant">GL_INDEX_SHIFT</code>,
121 and added to <code class="constant">GL_INDEX_OFFSET</code>.
122 If <code class="constant">GL_MAP_STENCIL</code> is <code class="constant">GL_TRUE</code>,
123 indices are replaced by their mappings in the table <code class="constant">GL_PIXEL_MAP_S_TO_S</code>.
7faf1d71
AW
124 </p></dd><dt><span class="term"><code class="constant">GL_DEPTH_COMPONENT</code></span></dt><dd><p>
125 Depth values are read from the depth buffer.
126 Each component is converted to floating point such that the minimum depth
127 value maps to 0 and the maximum value maps to 1.
f37e7e3d
DH
128 Each component is then multiplied by <code class="constant">GL_DEPTH_SCALE</code>,
129 added to <code class="constant">GL_DEPTH_BIAS</code>,
130 and finally clamped to the range
7faf1d71
AW
131 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
132
133 <mml:mfenced open="[" close="]">
134 <mml:mn>0</mml:mn>
135 <mml:mn>1</mml:mn>
136 </mml:mfenced>
137 </mml:math>.
138 </p></dd><dt><span class="term"><code class="constant">GL_DEPTH_STENCIL</code></span></dt><dd><p>
139 Values are taken from both the depth and stencil buffers. The <em class="parameter"><code>type</code></em> parameter
140 must be <code class="constant">GL_UNSIGNED_INT_24_8</code> or <code class="constant">GL_FLOAT_32_UNSIGNED_INT_24_8_REV</code>.
141 </p></dd><dt><span class="term"><code class="constant">GL_RED</code></span></dt><dd></dd><dt><span class="term"><code class="constant">GL_GREEN</code></span></dt><dd></dd><dt><span class="term"><code class="constant">GL_BLUE</code></span></dt><dd></dd><dt><span class="term"><code class="constant">GL_RGB</code></span></dt><dd></dd><dt><span class="term"><code class="constant">GL_BGR</code></span></dt><dd></dd><dt><span class="term"><code class="constant">GL_RGBA</code></span></dt><dd></dd><dt><span class="term"><code class="constant">GL_BGRA</code></span></dt><dd></dd></dl></div><p>
142 Finally, the indices or components
143 are converted to the proper format,
144 as specified by <em class="parameter"><code>type</code></em>.
145 If <em class="parameter"><code>format</code></em> is <code class="constant">GL_STENCIL_INDEX</code>
146 and <em class="parameter"><code>type</code></em> is not <code class="constant">GL_FLOAT</code>,
147 each index is masked with the mask value given in the following table.
148 If <em class="parameter"><code>type</code></em> is <code class="constant">GL_FLOAT</code>, then each integer index is converted to
149 single-precision floating-point format.
150 </p><p>
151 If <em class="parameter"><code>format</code></em> is
152 <code class="constant">GL_RED</code>,
153 <code class="constant">GL_GREEN</code>,
154 <code class="constant">GL_BLUE</code>,
155 <code class="constant">GL_RGB</code>,
156 <code class="constant">GL_BGR</code>,
157 <code class="constant">GL_RGBA</code>, or
158 <code class="constant">GL_BGRA</code> and <em class="parameter"><code>type</code></em> is not <code class="constant">GL_FLOAT</code>,
159 each component is multiplied by the multiplier shown in the following table.
160 If type is <code class="constant">GL_FLOAT</code>, then each component is passed as is
161 (or converted to the client's single-precision floating-point format if
162 it is different from the one used by the GL).
163 </p><p>
164 </p><div class="informaltable"><table border="1"><colgroup><col align="left" /><col align="center" /><col align="center" /></colgroup><thead><tr><th align="left">
165 <em class="parameter"><code>type</code></em>
166 </th><th align="center"><span class="bold"><strong>
167 Index Mask
168 </strong></span></th><th align="center"><span class="bold"><strong>
169 Component Conversion
170 </strong></span></th></tr></thead><tbody><tr><td align="left">
171 <code class="constant">GL_UNSIGNED_BYTE</code>
172 </td><td align="center">
173 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
174
175 <mml:mrow>
176 <mml:msup><mml:mn>2</mml:mn>
177 <mml:mn>8</mml:mn>
178 </mml:msup>
179 <mml:mo>-</mml:mo>
180 <mml:mn>1</mml:mn>
181 </mml:mrow>
182 </mml:math>
183 </td><td align="center">
184 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
185
186 <mml:mrow>
187 <mml:mfenced open="(" close=")">
188 <mml:mrow>
189 <mml:msup><mml:mn>2</mml:mn>
190 <mml:mn>8</mml:mn>
191 </mml:msup>
192 <mml:mo>-</mml:mo>
193 <mml:mn>1</mml:mn>
194 </mml:mrow>
195 </mml:mfenced>
196 <mml:mo>⁢</mml:mo>
197 <mml:mi mathvariant="italic">c</mml:mi>
198 </mml:mrow>
199 </mml:math>
200 </td></tr><tr><td align="left">
201 <code class="constant">GL_BYTE</code>
202 </td><td align="center">
203 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
204
205 <mml:mrow>
206 <mml:msup><mml:mn>2</mml:mn>
207 <mml:mn>7</mml:mn>
208 </mml:msup>
209 <mml:mo>-</mml:mo>
210 <mml:mn>1</mml:mn>
211 </mml:mrow>
212 </mml:math>
213 </td><td align="center">
214 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
215
216 <mml:mfrac>
217 <mml:mfenced open="" close="">
218 <mml:mrow>
219 <mml:mfenced open="(" close=")">
220 <mml:mrow>
221 <mml:msup><mml:mn>2</mml:mn>
222 <mml:mn>8</mml:mn>
223 </mml:msup>
224 <mml:mo>-</mml:mo>
225 <mml:mn>1</mml:mn>
226 </mml:mrow>
227 </mml:mfenced>
228 <mml:mo>⁢</mml:mo>
229 <mml:mi mathvariant="italic">c</mml:mi>
230 <mml:mo>-</mml:mo>
231 <mml:mn>1</mml:mn>
232 </mml:mrow>
233 </mml:mfenced>
234 <mml:mn>2</mml:mn>
235 </mml:mfrac>
236 </mml:math>
237 </td></tr><tr><td align="left">
238 <code class="constant">GL_UNSIGNED_SHORT</code>
239 </td><td align="center">
240 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
241
242 <mml:mrow>
243 <mml:msup><mml:mn>2</mml:mn>
244 <mml:mn>16</mml:mn>
245 </mml:msup>
246 <mml:mo>-</mml:mo>
247 <mml:mn>1</mml:mn>
248 </mml:mrow>
249 </mml:math>
250 </td><td align="center">
251 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
252
253 <mml:mrow>
254 <mml:mfenced open="(" close=")">
255 <mml:mrow>
256 <mml:msup><mml:mn>2</mml:mn>
257 <mml:mn>16</mml:mn>
258 </mml:msup>
259 <mml:mo>-</mml:mo>
260 <mml:mn>1</mml:mn>
261 </mml:mrow>
262 </mml:mfenced>
263 <mml:mo>⁢</mml:mo>
264 <mml:mi mathvariant="italic">c</mml:mi>
265 </mml:mrow>
266 </mml:math>
267 </td></tr><tr><td align="left">
268 <code class="constant">GL_SHORT</code>
269 </td><td align="center">
270 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
271
272 <mml:mrow>
273 <mml:msup><mml:mn>2</mml:mn>
274 <mml:mn>15</mml:mn>
275 </mml:msup>
276 <mml:mo>-</mml:mo>
277 <mml:mn>1</mml:mn>
278 </mml:mrow>
279 </mml:math>
280 </td><td align="center">
281 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
282
283 <mml:mfrac>
284 <mml:mfenced open="" close="">
285 <mml:mrow>
286 <mml:mfenced open="(" close=")">
287 <mml:mrow>
288 <mml:msup><mml:mn>2</mml:mn>
289 <mml:mn>16</mml:mn>
290 </mml:msup>
291 <mml:mo>-</mml:mo>
292 <mml:mn>1</mml:mn>
293 </mml:mrow>
294 </mml:mfenced>
295 <mml:mo>⁢</mml:mo>
296 <mml:mi mathvariant="italic">c</mml:mi>
297 <mml:mo>-</mml:mo>
298 <mml:mn>1</mml:mn>
299 </mml:mrow>
300 </mml:mfenced>
301 <mml:mn>2</mml:mn>
302 </mml:mfrac>
303 </mml:math>
304 </td></tr><tr><td align="left">
305 <code class="constant">GL_UNSIGNED_INT</code>
306 </td><td align="center">
307 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
308
309 <mml:mrow>
310 <mml:msup><mml:mn>2</mml:mn>
311 <mml:mn>32</mml:mn>
312 </mml:msup>
313 <mml:mo>-</mml:mo>
314 <mml:mn>1</mml:mn>
315 </mml:mrow>
316 </mml:math>
317 </td><td align="center">
318 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
319
320 <mml:mrow>
321 <mml:mfenced open="(" close=")">
322 <mml:mrow>
323 <mml:msup><mml:mn>2</mml:mn>
324 <mml:mn>32</mml:mn>
325 </mml:msup>
326 <mml:mo>-</mml:mo>
327 <mml:mn>1</mml:mn>
328 </mml:mrow>
329 </mml:mfenced>
330 <mml:mo>⁢</mml:mo>
331 <mml:mi mathvariant="italic">c</mml:mi>
332 </mml:mrow>
333 </mml:math>
334 </td></tr><tr><td align="left">
335 <code class="constant">GL_INT</code>
336 </td><td align="center">
337 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
338
339 <mml:mrow>
340 <mml:msup><mml:mn>2</mml:mn>
341 <mml:mn>31</mml:mn>
342 </mml:msup>
343 <mml:mo>-</mml:mo>
344 <mml:mn>1</mml:mn>
345 </mml:mrow>
346 </mml:math>
347 </td><td align="center">
348 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
349
350 <mml:mfrac>
351 <mml:mfenced open="" close="">
352 <mml:mrow>
353 <mml:mfenced open="(" close=")">
354 <mml:mrow>
355 <mml:msup><mml:mn>2</mml:mn>
356 <mml:mn>32</mml:mn>
357 </mml:msup>
358 <mml:mo>-</mml:mo>
359 <mml:mn>1</mml:mn>
360 </mml:mrow>
361 </mml:mfenced>
362 <mml:mo>⁢</mml:mo>
363 <mml:mi mathvariant="italic">c</mml:mi>
364 <mml:mo>-</mml:mo>
365 <mml:mn>1</mml:mn>
366 </mml:mrow>
367 </mml:mfenced>
368 <mml:mn>2</mml:mn>
369 </mml:mfrac>
370 </mml:math>
371 </td></tr><tr><td align="left">
372 <code class="constant">GL_HALF_FLOAT</code>
373 </td><td align="center">
374 none
375 </td><td align="center">
376 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">c</mml:mi></mml:math>
377 </td></tr><tr><td align="left">
378 <code class="constant">GL_FLOAT</code>
379 </td><td align="center">
380 none
381 </td><td align="center">
382 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">c</mml:mi></mml:math>
383 </td></tr><tr><td align="left">
384 <code class="constant">GL_UNSIGNED_BYTE_3_3_2</code>
385 </td><td align="center">
386 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
387
388 <mml:mrow>
389 <mml:msup><mml:mn>2</mml:mn>
390 <mml:mn>N</mml:mn>
391 </mml:msup>
392 <mml:mo>-</mml:mo>
393 <mml:mn>1</mml:mn>
394 </mml:mrow>
395 </mml:math>
396 </td><td align="center">
397 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
398
399 <mml:mrow>
400 <mml:mfenced open="(" close=")">
401 <mml:mrow>
402 <mml:msup><mml:mn>2</mml:mn>
403 <mml:mn>N</mml:mn>
404 </mml:msup>
405 <mml:mo>-</mml:mo>
406 <mml:mn>1</mml:mn>
407 </mml:mrow>
408 </mml:mfenced>
409 <mml:mo>⁢</mml:mo>
410 <mml:mi mathvariant="italic">c</mml:mi>
411 </mml:mrow>
412 </mml:math>
413 </td></tr><tr><td align="left">
414 <code class="constant">GL_UNSIGNED_BYTE_2_3_3_REV</code>
415 </td><td align="center">
416 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
417
418 <mml:mrow>
419 <mml:msup><mml:mn>2</mml:mn>
420 <mml:mn>N</mml:mn>
421 </mml:msup>
422 <mml:mo>-</mml:mo>
423 <mml:mn>1</mml:mn>
424 </mml:mrow>
425 </mml:math>
426 </td><td align="center">
427 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
428
429 <mml:mrow>
430 <mml:mfenced open="(" close=")">
431 <mml:mrow>
432 <mml:msup><mml:mn>2</mml:mn>
433 <mml:mn>N</mml:mn>
434 </mml:msup>
435 <mml:mo>-</mml:mo>
436 <mml:mn>1</mml:mn>
437 </mml:mrow>
438 </mml:mfenced>
439 <mml:mo>⁢</mml:mo>
440 <mml:mi mathvariant="italic">c</mml:mi>
441 </mml:mrow>
442 </mml:math>
443 </td></tr><tr><td align="left">
444 <code class="constant">GL_UNSIGNED_SHORT_5_6_5</code>
445 </td><td align="center">
446 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
447
448 <mml:mrow>
449 <mml:msup><mml:mn>2</mml:mn>
450 <mml:mn>N</mml:mn>
451 </mml:msup>
452 <mml:mo>-</mml:mo>
453 <mml:mn>1</mml:mn>
454 </mml:mrow>
455 </mml:math>
456 </td><td align="center">
457 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
458
459 <mml:mrow>
460 <mml:mfenced open="(" close=")">
461 <mml:mrow>
462 <mml:msup><mml:mn>2</mml:mn>
463 <mml:mn>N</mml:mn>
464 </mml:msup>
465 <mml:mo>-</mml:mo>
466 <mml:mn>1</mml:mn>
467 </mml:mrow>
468 </mml:mfenced>
469 <mml:mo>⁢</mml:mo>
470 <mml:mi mathvariant="italic">c</mml:mi>
471 </mml:mrow>
472 </mml:math>
473 </td></tr><tr><td align="left">
474 <code class="constant">GL_UNSIGNED_SHORT_5_6_5_REV</code>
475 </td><td align="center">
476 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
477
478 <mml:mrow>
479 <mml:msup><mml:mn>2</mml:mn>
480 <mml:mn>N</mml:mn>
481 </mml:msup>
482 <mml:mo>-</mml:mo>
483 <mml:mn>1</mml:mn>
484 </mml:mrow>
485 </mml:math>
486 </td><td align="center">
487 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
488
489 <mml:mrow>
490 <mml:mfenced open="(" close=")">
491 <mml:mrow>
492 <mml:msup><mml:mn>2</mml:mn>
493 <mml:mn>N</mml:mn>
494 </mml:msup>
495 <mml:mo>-</mml:mo>
496 <mml:mn>1</mml:mn>
497 </mml:mrow>
498 </mml:mfenced>
499 <mml:mo>⁢</mml:mo>
500 <mml:mi mathvariant="italic">c</mml:mi>
501 </mml:mrow>
502 </mml:math>
503 </td></tr><tr><td align="left">
504 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4</code>
505 </td><td align="center">
506 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
507
508 <mml:mrow>
509 <mml:msup><mml:mn>2</mml:mn>
510 <mml:mn>N</mml:mn>
511 </mml:msup>
512 <mml:mo>-</mml:mo>
513 <mml:mn>1</mml:mn>
514 </mml:mrow>
515 </mml:math>
516 </td><td align="center">
517 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
518
519 <mml:mrow>
520 <mml:mfenced open="(" close=")">
521 <mml:mrow>
522 <mml:msup><mml:mn>2</mml:mn>
523 <mml:mn>N</mml:mn>
524 </mml:msup>
525 <mml:mo>-</mml:mo>
526 <mml:mn>1</mml:mn>
527 </mml:mrow>
528 </mml:mfenced>
529 <mml:mo>⁢</mml:mo>
530 <mml:mi mathvariant="italic">c</mml:mi>
531 </mml:mrow>
532 </mml:math>
533 </td></tr><tr><td align="left">
534 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4_REV</code>
535 </td><td align="center">
536 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
537
538 <mml:mrow>
539 <mml:msup><mml:mn>2</mml:mn>
540 <mml:mn>N</mml:mn>
541 </mml:msup>
542 <mml:mo>-</mml:mo>
543 <mml:mn>1</mml:mn>
544 </mml:mrow>
545 </mml:math>
546 </td><td align="center">
547 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
548
549 <mml:mrow>
550 <mml:mfenced open="(" close=")">
551 <mml:mrow>
552 <mml:msup><mml:mn>2</mml:mn>
553 <mml:mn>N</mml:mn>
554 </mml:msup>
555 <mml:mo>-</mml:mo>
556 <mml:mn>1</mml:mn>
557 </mml:mrow>
558 </mml:mfenced>
559 <mml:mo>⁢</mml:mo>
560 <mml:mi mathvariant="italic">c</mml:mi>
561 </mml:mrow>
562 </mml:math>
563 </td></tr><tr><td align="left">
564 <code class="constant">GL_UNSIGNED_SHORT_5_5_5_1</code>
565 </td><td align="center">
566 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
567
568 <mml:mrow>
569 <mml:msup><mml:mn>2</mml:mn>
570 <mml:mn>N</mml:mn>
571 </mml:msup>
572 <mml:mo>-</mml:mo>
573 <mml:mn>1</mml:mn>
574 </mml:mrow>
575 </mml:math>
576 </td><td align="center">
577 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
578
579 <mml:mrow>
580 <mml:mfenced open="(" close=")">
581 <mml:mrow>
582 <mml:msup><mml:mn>2</mml:mn>
583 <mml:mn>N</mml:mn>
584 </mml:msup>
585 <mml:mo>-</mml:mo>
586 <mml:mn>1</mml:mn>
587 </mml:mrow>
588 </mml:mfenced>
589 <mml:mo>⁢</mml:mo>
590 <mml:mi mathvariant="italic">c</mml:mi>
591 </mml:mrow>
592 </mml:math>
593 </td></tr><tr><td align="left">
594 <code class="constant">GL_UNSIGNED_SHORT_1_5_5_5_REV</code>
595 </td><td align="center">
596 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
597
598 <mml:mrow>
599 <mml:msup><mml:mn>2</mml:mn>
600 <mml:mn>N</mml:mn>
601 </mml:msup>
602 <mml:mo>-</mml:mo>
603 <mml:mn>1</mml:mn>
604 </mml:mrow>
605 </mml:math>
606 </td><td align="center">
607 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
608
609 <mml:mrow>
610 <mml:mfenced open="(" close=")">
611 <mml:mrow>
612 <mml:msup><mml:mn>2</mml:mn>
613 <mml:mn>N</mml:mn>
614 </mml:msup>
615 <mml:mo>-</mml:mo>
616 <mml:mn>1</mml:mn>
617 </mml:mrow>
618 </mml:mfenced>
619 <mml:mo>⁢</mml:mo>
620 <mml:mi mathvariant="italic">c</mml:mi>
621 </mml:mrow>
622 </mml:math>
623 </td></tr><tr><td align="left">
624 <code class="constant">GL_UNSIGNED_INT_8_8_8_8</code>
625 </td><td align="center">
626 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
627
628 <mml:mrow>
629 <mml:msup><mml:mn>2</mml:mn>
630 <mml:mn>N</mml:mn>
631 </mml:msup>
632 <mml:mo>-</mml:mo>
633 <mml:mn>1</mml:mn>
634 </mml:mrow>
635 </mml:math>
636 </td><td align="center">
637 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
638
639 <mml:mrow>
640 <mml:mfenced open="(" close=")">
641 <mml:mrow>
642 <mml:msup><mml:mn>2</mml:mn>
643 <mml:mn>N</mml:mn>
644 </mml:msup>
645 <mml:mo>-</mml:mo>
646 <mml:mn>1</mml:mn>
647 </mml:mrow>
648 </mml:mfenced>
649 <mml:mo>⁢</mml:mo>
650 <mml:mi mathvariant="italic">c</mml:mi>
651 </mml:mrow>
652 </mml:math>
653 </td></tr><tr><td align="left">
654 <code class="constant">GL_UNSIGNED_INT_8_8_8_8_REV</code>
655 </td><td align="center">
656 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
657
658 <mml:mrow>
659 <mml:msup><mml:mn>2</mml:mn>
660 <mml:mn>N</mml:mn>
661 </mml:msup>
662 <mml:mo>-</mml:mo>
663 <mml:mn>1</mml:mn>
664 </mml:mrow>
665 </mml:math>
666 </td><td align="center">
667 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
668
669 <mml:mrow>
670 <mml:mfenced open="(" close=")">
671 <mml:mrow>
672 <mml:msup><mml:mn>2</mml:mn>
673 <mml:mn>N</mml:mn>
674 </mml:msup>
675 <mml:mo>-</mml:mo>
676 <mml:mn>1</mml:mn>
677 </mml:mrow>
678 </mml:mfenced>
679 <mml:mo>⁢</mml:mo>
680 <mml:mi mathvariant="italic">c</mml:mi>
681 </mml:mrow>
682 </mml:math>
683 </td></tr><tr><td align="left">
684 <code class="constant">GL_UNSIGNED_INT_10_10_10_2</code>
685 </td><td align="center">
686 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
687
688 <mml:mrow>
689 <mml:msup><mml:mn>2</mml:mn>
690 <mml:mn>N</mml:mn>
691 </mml:msup>
692 <mml:mo>-</mml:mo>
693 <mml:mn>1</mml:mn>
694 </mml:mrow>
695 </mml:math>
696 </td><td align="center">
697 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
698
699 <mml:mrow>
700 <mml:mfenced open="(" close=")">
701 <mml:mrow>
702 <mml:msup><mml:mn>2</mml:mn>
703 <mml:mn>N</mml:mn>
704 </mml:msup>
705 <mml:mo>-</mml:mo>
706 <mml:mn>1</mml:mn>
707 </mml:mrow>
708 </mml:mfenced>
709 <mml:mo>⁢</mml:mo>
710 <mml:mi mathvariant="italic">c</mml:mi>
711 </mml:mrow>
712 </mml:math>
713 </td></tr><tr><td align="left">
714 <code class="constant">GL_UNSIGNED_INT_2_10_10_10_REV</code>
715 </td><td align="center">
716 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
717
718 <mml:mrow>
719 <mml:msup><mml:mn>2</mml:mn>
720 <mml:mn>N</mml:mn>
721 </mml:msup>
722 <mml:mo>-</mml:mo>
723 <mml:mn>1</mml:mn>
724 </mml:mrow>
725 </mml:math>
726 </td><td align="center">
727 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
728
729 <mml:mrow>
730 <mml:mfenced open="(" close=")">
731 <mml:mrow>
732 <mml:msup><mml:mn>2</mml:mn>
733 <mml:mn>N</mml:mn>
734 </mml:msup>
735 <mml:mo>-</mml:mo>
736 <mml:mn>1</mml:mn>
737 </mml:mrow>
738 </mml:mfenced>
739 <mml:mo>⁢</mml:mo>
740 <mml:mi mathvariant="italic">c</mml:mi>
741 </mml:mrow>
742 </mml:math>
743 </td></tr><tr><td align="left">
744 <code class="constant">GL_UNSIGNED_INT_24_8</code>
745 </td><td align="center">
746 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
747
748 <mml:mrow>
749 <mml:msup><mml:mn>2</mml:mn>
750 <mml:mn>N</mml:mn>
751 </mml:msup>
752 <mml:mo>-</mml:mo>
753 <mml:mn>1</mml:mn>
754 </mml:mrow>
755 </mml:math>
756 </td><td align="center">
757 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
758
759 <mml:mrow>
760 <mml:mfenced open="(" close=")">
761 <mml:mrow>
762 <mml:msup><mml:mn>2</mml:mn>
763 <mml:mn>N</mml:mn>
764 </mml:msup>
765 <mml:mo>-</mml:mo>
766 <mml:mn>1</mml:mn>
767 </mml:mrow>
768 </mml:mfenced>
769 <mml:mo>⁢</mml:mo>
770 <mml:mi mathvariant="italic">c</mml:mi>
771 </mml:mrow>
772 </mml:math>
773 </td></tr><tr><td align="left">
774 <code class="constant">GL_UNSIGNED_INT_10F_11F_11F_REV</code>
775 </td><td align="center">
776 --
777 </td><td align="left">
778 Special
779 </td></tr><tr><td align="left">
780 <code class="constant">GL_UNSIGNED_INT_5_9_9_9_REV</code>
781 </td><td align="center">
782 --
783 </td><td align="left">
784 Special
785 </td></tr><tr><td align="left">
786 <code class="constant">GL_FLOAT_32_UNSIGNED_INT_24_8_REV</code>
787 </td><td align="center">
788 none
789 </td><td align="center">
790 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">c</mml:mi></mml:math> (Depth Only)
791 </td></tr></tbody></table></div><p>
792 Return values are placed in memory as follows.
793 If <em class="parameter"><code>format</code></em> is
794 <code class="constant">GL_STENCIL_INDEX</code>,
795 <code class="constant">GL_DEPTH_COMPONENT</code>,
796 <code class="constant">GL_RED</code>,
797 <code class="constant">GL_GREEN</code>, or
798 <code class="constant">GL_BLUE</code>,
799 a single value is returned and the data for the
800 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">i</mml:mi></mml:math>th
801 pixel in the
802 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">j</mml:mi></mml:math>th
803 row
804 is placed in location
805 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
806
807 <mml:mrow>
808 <mml:mfenced open="(" close=")">
809 <mml:mi mathvariant="italic">j</mml:mi>
810 </mml:mfenced>
811 <mml:mo>⁢</mml:mo>
812 <mml:mi mathvariant="italic">width</mml:mi>
813 <mml:mo>+</mml:mo>
814 <mml:mi mathvariant="italic">i</mml:mi>
815 </mml:mrow>
816 </mml:math>.
817 <code class="constant">GL_RGB</code> and <code class="constant">GL_BGR</code> return three values,
818 <code class="constant">GL_RGBA</code> and <code class="constant">GL_BGRA</code> return four values for each pixel,
819 with all values corresponding to a single pixel occupying contiguous space
820 in <em class="parameter"><code>data</code></em>.
821 Storage parameters set by <a href="glPixelStore.xml"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a>,
822 such as <code class="constant">GL_PACK_LSB_FIRST</code> and <code class="constant">GL_PACK_SWAP_BYTES</code>,
823 affect the way that data is written into memory.
824 See <a href="glPixelStore.xml"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a> for a description.
825 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p>
826 Values for pixels that lie outside the window
827 connected to the current GL context are undefined.
828 </p><p>
829 If an error is generated,
830 no change is made to the contents of <em class="parameter"><code>data</code></em>.
831 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
832 <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>format</code></em> or <em class="parameter"><code>type</code></em> is not an
833 accepted value.
834 </p><p>
835 <code class="constant">GL_INVALID_VALUE</code> is generated if either <em class="parameter"><code>width</code></em> or <em class="parameter"><code>height</code></em> is negative.
836 </p><p>
837 <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>format</code></em> is <code class="constant">GL_STENCIL_INDEX</code>
838 and there is no stencil buffer.
839 </p><p>
840 <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>format</code></em> is <code class="constant">GL_DEPTH_COMPONENT</code>
841 and there is no depth buffer.
842 </p><p>
843 <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>format</code></em> is <code class="constant">GL_DEPTH_STENCIL</code>
844 and there is no depth buffer or if there is no stencil buffer.
845 </p><p>
846 <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>format</code></em> is <code class="constant">GL_DEPTH_STENCIL</code>
847 and <em class="parameter"><code>type</code></em> is not <code class="constant">GL_UNSIGNED_INT_24_8</code> or <code class="constant">GL_FLOAT_32_UNSIGNED_INT_24_8_REV</code>.
848 </p><p>
849 <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>type</code></em> is one of
850 <code class="constant">GL_UNSIGNED_BYTE_3_3_2</code>,
851 <code class="constant">GL_UNSIGNED_BYTE_2_3_3_REV</code>,
852 <code class="constant">GL_UNSIGNED_SHORT_5_6_5</code>, or
853 <code class="constant">GL_UNSIGNED_SHORT_5_6_5_REV</code>
854 and <em class="parameter"><code>format</code></em> is not <code class="constant">GL_RGB</code>.
855 </p><p>
856 <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>type</code></em> is one of
857 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4</code>,
858 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4_REV</code>,
859 <code class="constant">GL_UNSIGNED_SHORT_5_5_5_1</code>,
860 <code class="constant">GL_UNSIGNED_SHORT_1_5_5_5_REV</code>,
861 <code class="constant">GL_UNSIGNED_INT_8_8_8_8</code>,
862 <code class="constant">GL_UNSIGNED_INT_8_8_8_8_REV</code>,
863 <code class="constant">GL_UNSIGNED_INT_10_10_10_2</code>, or
864 <code class="constant">GL_UNSIGNED_INT_2_10_10_10_REV</code>
865 and <em class="parameter"><code>format</code></em> is neither <code class="constant">GL_RGBA</code> nor <code class="constant">GL_BGRA</code>.
866 </p><p>
867 <code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to the
868 <code class="constant">GL_PIXEL_PACK_BUFFER</code> target and the buffer object's data store is currently mapped.
869 </p><p>
870 <code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to the
871 <code class="constant">GL_PIXEL_PACK_BUFFER</code> target and the data would be packed to the buffer
872 object such that the memory writes required would exceed the data store size.
873 </p><p>
874 <code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to the
875 <code class="constant">GL_PIXEL_PACK_BUFFER</code> target and <em class="parameter"><code>data</code></em> is not evenly divisible
876 into the number of bytes needed to store in memory a datum indicated by <em class="parameter"><code>type</code></em>.
877 </p><p>
878 <code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="constant">GL_READ_FRAMEBUFFER_BINDING</code>
879 is non-zero, the read framebuffer is complete, and the value of <code class="constant">GL_SAMPLE_BUFFERS</code>
880 for the read framebuffer is greater than zero.
881 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p>
f37e7e3d
DH
882 <a href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_INDEX_MODE</code>
883 </p><p>
7faf1d71
AW
884 <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>
885 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
886 <a href="glPixelStore.xml"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a>,
887 <a href="glReadBuffer.xml"><span class="citerefentry"><span class="refentrytitle">glReadBuffer</span></span></a>
888 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p>
889 Copyright <span class="trademark"></span>© 1991-2006
890 Silicon Graphics, Inc. This document is licensed under the SGI
891 Free Software B License. For details, see
892 <a href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>.
893 </p></div></div></body></html>