rename upstream-man-pages to upstream-doc
[clinton/guile-figl.git] / upstream-doc / man2 / xhtml / glDrawPixels.xml
CommitLineData
7faf1d71
AW
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
2<!-- saved from url=(0013)about:internet -->
3<?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" /><title>glDrawPixels</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glDrawPixels"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glDrawPixels — write a block of pixels to 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">glDrawPixels</b>(</code></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>const 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>width</code></em>, </span><span class="term"><em class="parameter"><code>height</code></em></span></dt><dd><p>
4 Specify the dimensions of the pixel rectangle to be written
5 into the frame buffer.
6 </p></dd><dt><span class="term"><em class="parameter"><code>format</code></em></span></dt><dd><p>
7 Specifies the format of the pixel data.
8 Symbolic constants
9 <code class="constant">GL_COLOR_INDEX</code>,
10 <code class="constant">GL_STENCIL_INDEX</code>,
11 <code class="constant">GL_DEPTH_COMPONENT</code>,
12 <code class="constant">GL_RGB</code>,
13 <code class="constant">GL_BGR</code>,
14 <code class="constant">GL_RGBA</code>,
15 <code class="constant">GL_BGRA</code>,
16 <code class="constant">GL_RED</code>,
17 <code class="constant">GL_GREEN</code>,
18 <code class="constant">GL_BLUE</code>,
19 <code class="constant">GL_ALPHA</code>,
20 <code class="constant">GL_LUMINANCE</code>, and
21 <code class="constant">GL_LUMINANCE_ALPHA</code> are accepted.
22 </p></dd><dt><span class="term"><em class="parameter"><code>type</code></em></span></dt><dd><p>
23 Specifies the data type for <em class="parameter"><code>data</code></em>.
24 Symbolic constants
25 <code class="constant">GL_UNSIGNED_BYTE</code>,
26 <code class="constant">GL_BYTE</code>,
27 <code class="constant">GL_BITMAP</code>,
28 <code class="constant">GL_UNSIGNED_SHORT</code>,
29 <code class="constant">GL_SHORT</code>,
30 <code class="constant">GL_UNSIGNED_INT</code>,
31 <code class="constant">GL_INT</code>,
32 <code class="constant">GL_FLOAT</code>,
33 <code class="constant">GL_UNSIGNED_BYTE_3_3_2</code>,
34 <code class="constant">GL_UNSIGNED_BYTE_2_3_3_REV</code>,
35 <code class="constant">GL_UNSIGNED_SHORT_5_6_5</code>,
36 <code class="constant">GL_UNSIGNED_SHORT_5_6_5_REV</code>,
37 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4</code>,
38 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4_REV</code>,
39 <code class="constant">GL_UNSIGNED_SHORT_5_5_5_1</code>,
40 <code class="constant">GL_UNSIGNED_SHORT_1_5_5_5_REV</code>,
41 <code class="constant">GL_UNSIGNED_INT_8_8_8_8</code>,
42 <code class="constant">GL_UNSIGNED_INT_8_8_8_8_REV</code>,
43 <code class="constant">GL_UNSIGNED_INT_10_10_10_2</code>, and
44 <code class="constant">GL_UNSIGNED_INT_2_10_10_10_REV</code>
45 are accepted.
46 </p></dd><dt><span class="term"><em class="parameter"><code>data</code></em></span></dt><dd><p>
47 Specifies a pointer to the pixel data.
48 </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
49 <code class="function">glDrawPixels</code> reads pixel data from memory and writes it into the frame buffer
50 relative to the current raster position, provided that the raster
51 position is valid. Use
52 <a class="citerefentry" href="glRasterPos.xml"><span class="citerefentry"><span class="refentrytitle">glRasterPos</span></span></a> or <a class="citerefentry" href="glWindowPos.xml"><span class="citerefentry"><span class="refentrytitle">glWindowPos</span></span></a> to set the current raster position; use
53 <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_CURRENT_RASTER_POSITION_VALID</code>
54 to determine if the specified raster position is valid, and
55 <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_CURRENT_RASTER_POSITION</code>
56 to query the raster position.
57 </p><p>
58 Several parameters define the encoding of pixel data in memory
59 and control the processing of the pixel data
60 before it is placed in the frame buffer.
61 These parameters are set with four commands:
62 <a class="citerefentry" href="glPixelStore.xml"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a>,
63 <a class="citerefentry" href="glPixelTransfer.xml"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a>,
64 <a class="citerefentry" href="glPixelMap.xml"><span class="citerefentry"><span class="refentrytitle">glPixelMap</span></span></a>, and <a class="citerefentry" href="glPixelZoom.xml"><span class="citerefentry"><span class="refentrytitle">glPixelZoom</span></span></a>.
65 This reference page describes the effects on <code class="function">glDrawPixels</code> of many,
66 but not all, of the parameters specified by these four commands.
67 </p><p>
68 Data is read from <em class="parameter"><code>data</code></em> as a sequence of signed or unsigned bytes,
69 signed or unsigned shorts, signed or unsigned integers, or
70 single-precision floating-point values, depending on <em class="parameter"><code>type</code></em>.
71 When <em class="parameter"><code>type</code></em> is one of <code class="constant">GL_UNSIGNED_BYTE</code>, <code class="constant">GL_BYTE</code>,
72 <code class="constant">GL_UNSIGNED_SHORT</code>, <code class="constant">GL_SHORT</code>, <code class="constant">GL_UNSIGNED_INT</code>,
73 <code class="constant">GL_INT</code>, or <code class="constant">GL_FLOAT</code> each of these bytes, shorts, integers, or
74 floating-point values is interpreted as one color or depth component, or
75 one index, depending on <em class="parameter"><code>format</code></em>.
76 When <em class="parameter"><code>type</code></em> is one of <code class="constant">GL_UNSIGNED_BYTE_3_3_2</code>,
77 <code class="constant">GL_UNSIGNED_SHORT_5_6_5</code>, <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4</code>,
78 <code class="constant">GL_UNSIGNED_SHORT_5_5_5_1</code>, <code class="constant">GL_UNSIGNED_INT_8_8_8_8</code>, or
79 <code class="constant">GL_UNSIGNED_INT_10_10_10_2</code>, each unsigned value is interpreted as
80 containing all the components for a single pixel, with the color
81 components arranged according to <em class="parameter"><code>format</code></em>.
82 When <em class="parameter"><code>type</code></em> is one of <code class="constant">GL_UNSIGNED_BYTE_2_3_3_REV</code>,
83 <code class="constant">GL_UNSIGNED_SHORT_5_6_5_REV</code>, <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4_REV</code>,
84 <code class="constant">GL_UNSIGNED_SHORT_1_5_5_5_REV</code>, <code class="constant">GL_UNSIGNED_INT_8_8_8_8_REV</code>, or
85 <code class="constant">GL_UNSIGNED_INT_2_10_10_10_REV</code>, each unsigned value is interpreted
86 as containing all color components, specified by <em class="parameter"><code>format</code></em>, for a single
87 pixel in a reversed order. Indices are always treated individually.
88 Color components are treated as groups of one, two, three, or four
89 values, again based on <em class="parameter"><code>format</code></em>. Both individual indices and groups of
90 components are referred to as pixels.
91 If <em class="parameter"><code>type</code></em> is <code class="constant">GL_BITMAP</code>, the data must be unsigned bytes, and
92 <em class="parameter"><code>format</code></em> must be either <code class="constant">GL_COLOR_INDEX</code> or <code class="constant">GL_STENCIL_INDEX</code>.
93 Each unsigned byte is treated as eight 1-bit pixels, with bit ordering
94 determined by <code class="constant">GL_UNPACK_LSB_FIRST</code> (see <a class="citerefentry" href="glPixelStore.xml"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a>).
95 </p><p>
96 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
97
98 <mml:mrow>
99 <mml:mi mathvariant="italic">width</mml:mi>
100 <mml:mo>×</mml:mo>
101 <mml:mi mathvariant="italic">height</mml:mi>
102 </mml:mrow>
103 </mml:math>
104 pixels are read from memory,
105 starting at location <em class="parameter"><code>data</code></em>.
106 By default, these pixels are taken from adjacent memory locations,
107 except that after all <em class="parameter"><code>width</code></em> pixels are read,
108 the read pointer is advanced to the next four-byte boundary.
109 The four-byte row alignment is specified by <a class="citerefentry" href="glPixelStore.xml"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a> with
110 argument <code class="constant">GL_UNPACK_ALIGNMENT</code>,
111 and it can be set to one, two, four, or eight bytes.
112 Other pixel store parameters specify different read pointer advancements,
113 both before the first pixel is read
114 and after all <em class="parameter"><code>width</code></em> pixels are read.
115 See the <a class="citerefentry" href="glPixelStore.xml"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a> reference page for details on these options.
116 </p><p>
117 If a non-zero named buffer object is bound to the <code class="constant">GL_PIXEL_UNPACK_BUFFER</code> target
118 (see <a class="citerefentry" href="glBindBuffer.xml"><span class="citerefentry"><span class="refentrytitle">glBindBuffer</span></span></a>) while a block of pixels is
119 specified, <em class="parameter"><code>data</code></em> is treated as a byte offset into the buffer object's data store.
120 </p><p>
121 The
122 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
123
124 <mml:mrow>
125 <mml:mi mathvariant="italic">width</mml:mi>
126 <mml:mo>×</mml:mo>
127 <mml:mi mathvariant="italic">height</mml:mi>
128 </mml:mrow>
129 </mml:math>
130 pixels that are read from memory are
131 each operated on in the same way,
132 based on the values of several parameters specified by <a class="citerefentry" href="glPixelTransfer.xml"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a>
133 and <a class="citerefentry" href="glPixelMap.xml"><span class="citerefentry"><span class="refentrytitle">glPixelMap</span></span></a>.
134 The details of these operations,
135 as well as the target buffer into which the pixels are drawn,
136 are specific to the format of the pixels,
137 as specified by <em class="parameter"><code>format</code></em>.
138 <em class="parameter"><code>format</code></em> can assume one of 13 symbolic values:
139 </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_COLOR_INDEX</code></span></dt><dd><p>
140 Each pixel is a single value,
141 a color index.
142 It is converted to fixed-point format,
143 with an unspecified number of bits to the right of the binary point,
144 regardless of the memory data type.
145 Floating-point values convert to true fixed-point values.
146 Signed and unsigned integer data is converted with all fraction bits
147 set to 0.
148 Bitmap data convert to either 0 or 1.
149 </p><p>
150 Each fixed-point index is then shifted left by <code class="constant">GL_INDEX_SHIFT</code> bits
151 and added to <code class="constant">GL_INDEX_OFFSET</code>.
152 If <code class="constant">GL_INDEX_SHIFT</code> is negative,
153 the shift is to the right.
154 In either case, zero bits fill otherwise unspecified bit locations in the
155 result.
156 </p><p>
157 If the GL is in RGBA mode,
158 the resulting index is converted to an RGBA pixel
159 with the help of the <code class="constant">GL_PIXEL_MAP_I_TO_R</code>,
160 <code class="constant">GL_PIXEL_MAP_I_TO_G</code>,
161 <code class="constant">GL_PIXEL_MAP_I_TO_B</code>,
162 and <code class="constant">GL_PIXEL_MAP_I_TO_A</code> tables.
163 If the GL is in color index mode,
164 and if <code class="constant">GL_MAP_COLOR</code> is true,
165 the index is replaced with the value that it references in lookup table
166 <code class="constant">GL_PIXEL_MAP_I_TO_I</code>.
167 Whether the lookup replacement of the index is done or not,
168 the integer part of the index is then ANDed with
169 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
170
171 <mml:mrow>
172 <mml:msup><mml:mn>2</mml:mn>
173 <mml:mi mathvariant="italic">b</mml:mi>
174 </mml:msup>
175 <mml:mo>-</mml:mo>
176 <mml:mn>1</mml:mn>
177 </mml:mrow>
178 </mml:math>,
179 where
180 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">b</mml:mi></mml:math>
181 is the number of bits in a color index buffer.
182 </p><p>
183 The GL then converts the resulting indices or RGBA colors to fragments
184 by attaching the current raster position <span class="emphasis"><em>z</em></span> coordinate and
185 texture coordinates to each pixel,
186 then assigning
187 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">x</mml:mi></mml:math>
188 and
189 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">y</mml:mi></mml:math>
190 window coordinates to the
191 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">n</mml:mi></mml:math>th
192 fragment such that
193 </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
194
195 <mml:mrow>
196 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
197 <mml:mi mathvariant="italic">n</mml:mi>
198 </mml:msub>
199 <mml:mo>=</mml:mo>
200 <mml:mrow>
201 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
202 <mml:mi mathvariant="italic">r</mml:mi>
203 </mml:msub>
204 <mml:mo>+</mml:mo>
205 <mml:mrow>
206 <mml:mi mathvariant="italic">n</mml:mi>
207 <mml:mo>%</mml:mo>
208 <mml:mi mathvariant="italic">width</mml:mi>
209 </mml:mrow>
210 </mml:mrow>
211 </mml:mrow>
212 </mml:math></div><p>
213 </p><p>
214 </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
215
216 <mml:mrow>
217 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
218 <mml:mi mathvariant="italic">n</mml:mi>
219 </mml:msub>
220 <mml:mo>=</mml:mo>
221 <mml:mrow>
222 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
223 <mml:mi mathvariant="italic">r</mml:mi>
224 </mml:msub>
225 <mml:mo>+</mml:mo>
226 <mml:mfenced open="&#x230A;" close="&#x230B;">
227 <mml:mfrac>
228 <mml:mi mathvariant="italic">n</mml:mi>
229 <mml:mi mathvariant="italic">width</mml:mi>
230 </mml:mfrac>
231 </mml:mfenced>
232 </mml:mrow>
233 </mml:mrow>
234 </mml:math></div><p>
235 </p><p>
236 </p><p>
237 </p><p>
238 </p><p>
239 where
240 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
241
242 <mml:mfenced open="(" close=")">
243 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
244 <mml:mi mathvariant="italic">r</mml:mi>
245 </mml:msub>
246 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
247 <mml:mi mathvariant="italic">r</mml:mi>
248 </mml:msub>
249 </mml:mfenced>
250 </mml:math>
251 is the current raster position.
252 These pixel fragments are then treated just like the fragments generated by
253 rasterizing points, lines, or polygons.
254 Texture mapping,
255 fog,
256 and all the fragment operations are applied before the fragments are written
257 to the frame buffer.
258 </p></dd><dt><span class="term"><code class="constant">GL_STENCIL_INDEX</code></span></dt><dd><p>
259 Each pixel is a single value,
260 a stencil index.
261 It is converted to fixed-point format,
262 with an unspecified number of bits to the right of the binary point,
263 regardless of the memory data type.
264 Floating-point values convert to true fixed-point values.
265 Signed and unsigned integer data is converted with all fraction bits
266 set to 0.
267 Bitmap data convert to either 0 or 1.
268 </p><p>
269 Each fixed-point index is then shifted left by <code class="constant">GL_INDEX_SHIFT</code> bits,
270 and added to <code class="constant">GL_INDEX_OFFSET</code>.
271 If <code class="constant">GL_INDEX_SHIFT</code> is negative,
272 the shift is to the right.
273 In either case, zero bits fill otherwise unspecified bit locations in the
274 result.
275 If <code class="constant">GL_MAP_STENCIL</code> is true,
276 the index is replaced with the value that it references in lookup table
277 <code class="constant">GL_PIXEL_MAP_S_TO_S</code>.
278 Whether the lookup replacement of the index is done or not,
279 the integer part of the index is then ANDed with
280 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
281
282 <mml:mrow>
283 <mml:msup><mml:mn>2</mml:mn>
284 <mml:mi mathvariant="italic">b</mml:mi>
285 </mml:msup>
286 <mml:mo>-</mml:mo>
287 <mml:mn>1</mml:mn>
288 </mml:mrow>
289 </mml:math>,
290 where
291 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">b</mml:mi></mml:math>
292 is the number of bits in the stencil buffer.
293 The resulting stencil indices are then written to the stencil buffer
294 such that the
295 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">n</mml:mi></mml:math>th
296 index is written to location
297 </p><p>
298 </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
299
300 <mml:mrow>
301 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
302 <mml:mi mathvariant="italic">n</mml:mi>
303 </mml:msub>
304 <mml:mo>=</mml:mo>
305 <mml:mrow>
306 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
307 <mml:mi mathvariant="italic">r</mml:mi>
308 </mml:msub>
309 <mml:mo>+</mml:mo>
310 <mml:mrow>
311 <mml:mi mathvariant="italic">n</mml:mi>
312 <mml:mo>%</mml:mo>
313 <mml:mi mathvariant="italic">width</mml:mi>
314 </mml:mrow>
315 </mml:mrow>
316 </mml:mrow>
317 </mml:math></div><p>
318 </p><p>
319 </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
320
321 <mml:mrow>
322 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
323 <mml:mi mathvariant="italic">n</mml:mi>
324 </mml:msub>
325 <mml:mo>=</mml:mo>
326 <mml:mrow>
327 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
328 <mml:mi mathvariant="italic">r</mml:mi>
329 </mml:msub>
330 <mml:mo>+</mml:mo>
331 <mml:mfenced open="&#x230A;" close="&#x230B;">
332 <mml:mfrac>
333 <mml:mi mathvariant="italic">n</mml:mi>
334 <mml:mi mathvariant="italic">width</mml:mi>
335 </mml:mfrac>
336 </mml:mfenced>
337 </mml:mrow>
338 </mml:mrow>
339 </mml:math></div><p>
340 </p><p>
341 </p><p>
342 where
343 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
344
345 <mml:mfenced open="(" close=")">
346 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
347 <mml:mi mathvariant="italic">r</mml:mi>
348 </mml:msub>
349 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
350 <mml:mi mathvariant="italic">r</mml:mi>
351 </mml:msub>
352 </mml:mfenced>
353 </mml:math>
354 is the current raster position.
355 Only the pixel ownership test,
356 the scissor test,
357 and the stencil writemask affect these write operations.
358 </p></dd><dt><span class="term"><code class="constant">GL_DEPTH_COMPONENT</code></span></dt><dd><p>
359 Each pixel is a single-depth component.
360 Floating-point data is converted directly to an internal floating-point
361 format with unspecified precision.
362 Signed integer data is mapped linearly to the internal floating-point
363 format such that the most positive representable integer value maps to 1.0,
364 and the most negative representable value maps to
365 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
366
367 <mml:mn>-1.0</mml:mn>
368 </mml:math>.
369 Unsigned integer data is mapped similarly:
370 the largest integer value maps to 1.0,
371 and 0 maps to 0.0.
372 The resulting floating-point depth value is then multiplied
373 by <code class="constant">GL_DEPTH_SCALE</code> and added to <code class="constant">GL_DEPTH_BIAS</code>.
374 The result is clamped to the range
375 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
376
377 <mml:mfenced open="[" close="]">
378 <mml:mn>0</mml:mn>
379 <mml:mn>1</mml:mn>
380 </mml:mfenced>
381 </mml:math>.
382 </p><p>
383 The GL then converts the resulting depth components to fragments
384 by attaching the current raster position color or color index and
385 texture coordinates to each pixel,
386 then assigning
387 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">x</mml:mi></mml:math>
388 and
389 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">y</mml:mi></mml:math>
390 window coordinates to the
391 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">n</mml:mi></mml:math>th
392 fragment such that
393 </p><p>
394 </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
395
396 <mml:mrow>
397 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
398 <mml:mi mathvariant="italic">n</mml:mi>
399 </mml:msub>
400 <mml:mo>=</mml:mo>
401 <mml:mrow>
402 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
403 <mml:mi mathvariant="italic">r</mml:mi>
404 </mml:msub>
405 <mml:mo>+</mml:mo>
406 <mml:mrow>
407 <mml:mi mathvariant="italic">n</mml:mi>
408 <mml:mo>%</mml:mo>
409 <mml:mi mathvariant="italic">width</mml:mi>
410 </mml:mrow>
411 </mml:mrow>
412 </mml:mrow>
413 </mml:math></div><p>
414 </p><p>
415 </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
416
417 <mml:mrow>
418 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
419 <mml:mi mathvariant="italic">n</mml:mi>
420 </mml:msub>
421 <mml:mo>=</mml:mo>
422 <mml:mrow>
423 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
424 <mml:mi mathvariant="italic">r</mml:mi>
425 </mml:msub>
426 <mml:mo>+</mml:mo>
427 <mml:mfenced open="&#x230A;" close="&#x230B;">
428 <mml:mfrac>
429 <mml:mi mathvariant="italic">n</mml:mi>
430 <mml:mi mathvariant="italic">width</mml:mi>
431 </mml:mfrac>
432 </mml:mfenced>
433 </mml:mrow>
434 </mml:mrow>
435 </mml:math></div><p>
436 </p><p>
437 </p><p>
438 where
439 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
440
441 <mml:mfenced open="(" close=")">
442 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
443 <mml:mi mathvariant="italic">r</mml:mi>
444 </mml:msub>
445 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
446 <mml:mi mathvariant="italic">r</mml:mi>
447 </mml:msub>
448 </mml:mfenced>
449 </mml:math>
450 is the current raster position.
451 These pixel fragments are then treated just like the fragments generated by
452 rasterizing points, lines, or polygons.
453 Texture mapping,
454 fog,
455 and all the fragment operations are applied before the fragments are written
456 to the frame buffer.
457 </p></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><p>
458 Each pixel is a four-component group: For <code class="constant">GL_RGBA</code>, the red
459 component is first, followed by green, followed by blue, followed by
460 alpha; for <code class="constant">GL_BGRA</code> the order is blue, green, red and then alpha.
461 Floating-point values are converted directly to an internal floating-point
462 format with unspecified precision.
463 Signed integer values are mapped linearly to the internal floating-point
464 format such that the most positive representable integer value maps to 1.0,
465 and the most negative representable value maps to
466 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
467
468 <mml:mn>-1.0</mml:mn>
469 </mml:math>.
470 (Note that
471 this mapping does not convert 0 precisely to 0.0.)
472 Unsigned integer data is mapped similarly:
473 The largest integer value maps to 1.0,
474 and 0 maps to 0.0.
475 The resulting floating-point color values are then multiplied
476 by <code class="constant">GL_c_SCALE</code> and added to <code class="constant">GL_c_BIAS</code>,
477 where <span class="emphasis"><em>c</em></span> is RED, GREEN, BLUE, and ALPHA
478 for the respective color components.
479 The results are clamped to the range
480 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
481
482 <mml:mfenced open="[" close="]">
483 <mml:mn>0</mml:mn>
484 <mml:mn>1</mml:mn>
485 </mml:mfenced>
486 </mml:math>.
487 </p><p>
488 If <code class="constant">GL_MAP_COLOR</code> is true,
489 each color component is scaled by the size of lookup table
490 <code class="constant">GL_PIXEL_MAP_c_TO_c</code>,
491 then replaced by the value that it references in that table.
492 <span class="emphasis"><em>c</em></span> is R, G, B, or A respectively.
493 </p><p>
494 The GL then converts the resulting RGBA colors to fragments
495 by attaching the current raster position <span class="emphasis"><em>z</em></span> coordinate and
496 texture coordinates to each pixel,
497 then assigning
498 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">x</mml:mi></mml:math>
499 and
500 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">y</mml:mi></mml:math>
501 window coordinates to the
502 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">n</mml:mi></mml:math>th
503 fragment such that
504 </p><p>
505 </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
506
507 <mml:mrow>
508 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
509 <mml:mi mathvariant="italic">n</mml:mi>
510 </mml:msub>
511 <mml:mo>=</mml:mo>
512 <mml:mrow>
513 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
514 <mml:mi mathvariant="italic">r</mml:mi>
515 </mml:msub>
516 <mml:mo>+</mml:mo>
517 <mml:mrow>
518 <mml:mi mathvariant="italic">n</mml:mi>
519 <mml:mo>%</mml:mo>
520 <mml:mi mathvariant="italic">width</mml:mi>
521 </mml:mrow>
522 </mml:mrow>
523 </mml:mrow>
524 </mml:math></div><p>
525 </p><p>
526 </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
527
528 <mml:mrow>
529 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
530 <mml:mi mathvariant="italic">n</mml:mi>
531 </mml:msub>
532 <mml:mo>=</mml:mo>
533 <mml:mrow>
534 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
535 <mml:mi mathvariant="italic">r</mml:mi>
536 </mml:msub>
537 <mml:mo>+</mml:mo>
538 <mml:mfenced open="&#x230A;" close="&#x230B;">
539 <mml:mfrac>
540 <mml:mi mathvariant="italic">n</mml:mi>
541 <mml:mi mathvariant="italic">width</mml:mi>
542 </mml:mfrac>
543 </mml:mfenced>
544 </mml:mrow>
545 </mml:mrow>
546 </mml:math></div><p>
547 </p><p>
548 </p><p>
549 where
550 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
551
552 <mml:mfenced open="(" close=")">
553 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
554 <mml:mi mathvariant="italic">r</mml:mi>
555 </mml:msub>
556 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
557 <mml:mi mathvariant="italic">r</mml:mi>
558 </mml:msub>
559 </mml:mfenced>
560 </mml:math>
561 is the current raster position.
562 These pixel fragments are then treated just like the fragments generated by
563 rasterizing points, lines, or polygons.
564 Texture mapping,
565 fog,
566 and all the fragment operations are applied before the fragments are written
567 to the frame buffer.
568 </p></dd><dt><span class="term"><code class="constant">GL_RED</code></span></dt><dd><p>
569 Each pixel is a single red component.
570 This component is converted to the internal floating-point format in
571 the same way the red component of an RGBA pixel is. It is
572 then converted to an RGBA pixel with green and blue set to 0,
573 and alpha set to 1.
574 After this conversion, the pixel is treated as if it had been read
575 as an RGBA pixel.
576 </p></dd><dt><span class="term"><code class="constant">GL_GREEN</code></span></dt><dd><p>
577 Each pixel is a single green component.
578 This component is converted to the internal floating-point format in
579 the same way the green component of an RGBA pixel is.
580 It is then converted to an RGBA pixel with red and blue set to 0,
581 and alpha set to 1.
582 After this conversion, the pixel is treated as if it had been read
583 as an RGBA pixel.
584 </p></dd><dt><span class="term"><code class="constant">GL_BLUE</code></span></dt><dd><p>
585 Each pixel is a single blue component.
586 This component is converted to the internal floating-point format in
587 the same way the blue component of an RGBA pixel is.
588 It is then converted to an RGBA pixel with red and green set to 0,
589 and alpha set to 1.
590 After this conversion, the pixel is treated as if it had been read
591 as an RGBA pixel.
592 </p></dd><dt><span class="term"><code class="constant">GL_ALPHA</code></span></dt><dd><p>
593 Each pixel is a single alpha component.
594 This component is converted to the internal floating-point format in
595 the same way the alpha component of an RGBA pixel is.
596 It is then converted to an RGBA pixel with red, green, and blue set to 0.
597 After this conversion, the pixel is treated as if it had been read
598 as an RGBA pixel.
599 </p></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><p>
600 Each pixel is a three-component group:
601 red first, followed by green, followed by blue; for <code class="constant">GL_BGR</code>, the
602 first component is blue, followed by green and then red.
603 Each component is converted to the internal floating-point format in
604 the same way the red, green, and blue components of an RGBA pixel are.
605 The color triple is converted to an RGBA pixel with alpha set to 1.
606 After this conversion, the pixel is treated as if it had been read
607 as an RGBA pixel.
608 </p></dd><dt><span class="term"><code class="constant">GL_LUMINANCE</code></span></dt><dd><p>
609 Each pixel is a single luminance component.
610 This component is converted to the internal floating-point format in
611 the same way the red component of an RGBA pixel is.
612 It is then converted to an RGBA pixel with red, green, and blue set to the
613 converted luminance value,
614 and alpha set to 1.
615 After this conversion, the pixel is treated as if it had been read
616 as an RGBA pixel.
617 </p></dd><dt><span class="term"><code class="constant">GL_LUMINANCE_ALPHA</code></span></dt><dd><p>
618 Each pixel is a two-component group:
619 luminance first, followed by alpha.
620 The two components are converted to the internal floating-point format in
621 the same way the red component of an RGBA pixel is.
622 They are then converted to an RGBA pixel with red, green, and blue set to the
623 converted luminance value,
624 and alpha set to the converted alpha value.
625 After this conversion, the pixel is treated as if it had been read
626 as an RGBA pixel.
627
628 </p></dd></dl></div><p>
629 The following table summarizes the meaning of the valid constants for the
630 <span class="emphasis"><em>type</em></span> parameter:
631 </p><p>
632 </p><div class="informaltable"><table border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left"><span class="bold"><strong>
633 Type
634 </strong></span></th><th align="left"><span class="bold"><strong>
635 Corresponding Type
636 </strong></span></th></tr></thead><tbody><tr><td align="left">
637 <code class="constant">GL_UNSIGNED_BYTE</code>
638 </td><td align="left">
639 unsigned 8-bit integer
640 </td></tr><tr><td align="left">
641 <code class="constant">GL_BYTE</code>
642 </td><td align="left">
643 signed 8-bit integer
644 </td></tr><tr><td align="left">
645 <code class="constant">GL_BITMAP</code>
646 </td><td align="left">
647 single bits in unsigned 8-bit integers
648 </td></tr><tr><td align="left">
649 <code class="constant">GL_UNSIGNED_SHORT</code>
650 </td><td align="left">
651 unsigned 16-bit integer
652 </td></tr><tr><td align="left">
653 <code class="constant">GL_SHORT</code>
654 </td><td align="left">
655 signed 16-bit integer
656 </td></tr><tr><td align="left">
657 <code class="constant">GL_UNSIGNED_INT</code>
658 </td><td align="left">
659 unsigned 32-bit integer
660 </td></tr><tr><td align="left">
661 <code class="constant">GL_INT</code>
662 </td><td align="left">
663 32-bit integer
664 </td></tr><tr><td align="left">
665 <code class="constant">GL_FLOAT</code>
666 </td><td align="left">
667 single-precision floating-point
668 </td></tr><tr><td align="left">
669 <code class="constant">GL_UNSIGNED_BYTE_3_3_2</code>
670 </td><td align="left">
671 unsigned 8-bit integer
672 </td></tr><tr><td align="left">
673 <code class="constant">GL_UNSIGNED_BYTE_2_3_3_REV</code>
674 </td><td align="left">
675 unsigned 8-bit integer with reversed component ordering
676 </td></tr><tr><td align="left">
677 <code class="constant">GL_UNSIGNED_SHORT_5_6_5</code>
678 </td><td align="left">
679 unsigned 16-bit integer
680 </td></tr><tr><td align="left">
681 <code class="constant">GL_UNSIGNED_SHORT_5_6_5_REV</code>
682 </td><td align="left">
683 unsigned 16-bit integer with reversed component ordering
684 </td></tr><tr><td align="left">
685 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4</code>
686 </td><td align="left">
687 unsigned 16-bit integer
688 </td></tr><tr><td align="left">
689 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4_REV</code>
690 </td><td align="left">
691 unsigned 16-bit integer with reversed component ordering
692 </td></tr><tr><td align="left">
693 <code class="constant">GL_UNSIGNED_SHORT_5_5_5_1</code>
694 </td><td align="left">
695 unsigned 16-bit integer
696 </td></tr><tr><td align="left">
697 <code class="constant">GL_UNSIGNED_SHORT_1_5_5_5_REV</code>
698 </td><td align="left">
699 unsigned 16-bit integer with reversed component ordering
700 </td></tr><tr><td align="left">
701 <code class="constant">GL_UNSIGNED_INT_8_8_8_8</code>
702 </td><td align="left">
703 unsigned 32-bit integer
704 </td></tr><tr><td align="left">
705 <code class="constant">GL_UNSIGNED_INT_8_8_8_8_REV</code>
706 </td><td align="left">
707 unsigned 32-bit integer with reversed component ordering
708 </td></tr><tr><td align="left">
709 <code class="constant">GL_UNSIGNED_INT_10_10_10_2</code>
710 </td><td align="left">
711 unsigned 32-bit integer
712 </td></tr><tr><td align="left">
713 <code class="constant">GL_UNSIGNED_INT_2_10_10_10_REV</code>
714 </td><td align="left">
715 unsigned 32-bit integer with reversed component ordering
716 </td></tr></tbody></table></div><p>
717 </p><p>
718 </p><p>
719 The rasterization described so far assumes pixel zoom factors of 1.
720 If
721 <a class="citerefentry" href="glPixelZoom.xml"><span class="citerefentry"><span class="refentrytitle">glPixelZoom</span></span></a> is used to change the
722 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">x</mml:mi></mml:math>
723 and
724 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">y</mml:mi></mml:math>
725 pixel zoom factors,
726 pixels are converted to fragments as follows.
727 If
728 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
729
730 <mml:mfenced open="(" close=")">
731 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
732 <mml:mi mathvariant="italic">r</mml:mi>
733 </mml:msub>
734 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
735 <mml:mi mathvariant="italic">r</mml:mi>
736 </mml:msub>
737 </mml:mfenced>
738 </mml:math>
739 is the current raster position,
740 and a given pixel is in the
741 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">n</mml:mi></mml:math>th
742 column and
743 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">m</mml:mi></mml:math>th
744 row
745 of the pixel rectangle,
746 then fragments are generated for pixels whose centers are in the rectangle
747 with corners at
748 </p><p>
749 </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
750
751 <mml:mfenced open="(" close=")">
752 <mml:mrow>
753 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
754 <mml:mi mathvariant="italic">r</mml:mi>
755 </mml:msub>
756 <mml:mo>+</mml:mo>
757 <mml:mfenced open="" close="">
758 <mml:msub><mml:mi mathvariant="italic">zoom</mml:mi>
759 <mml:mi mathvariant="italic">x</mml:mi>
760 </mml:msub>
761 </mml:mfenced>
762 <mml:mo>⁢</mml:mo>
763 <mml:mi mathvariant="italic">n</mml:mi>
764 </mml:mrow>
765 <mml:mrow>
766 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
767 <mml:mi mathvariant="italic">r</mml:mi>
768 </mml:msub>
769 <mml:mo>+</mml:mo>
770 <mml:mfenced open="" close="">
771 <mml:msub><mml:mi mathvariant="italic">zoom</mml:mi>
772 <mml:mi mathvariant="italic">y</mml:mi>
773 </mml:msub>
774 </mml:mfenced>
775 <mml:mo>⁢</mml:mo>
776 <mml:mi mathvariant="italic">m</mml:mi>
777 </mml:mrow>
778 </mml:mfenced>
779 </mml:math></div><p>
780 </p><p>
781 </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
782
783 <mml:mfenced open="(" close=")">
784 <mml:mrow>
785 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
786 <mml:mi mathvariant="italic">r</mml:mi>
787 </mml:msub>
788 <mml:mo>+</mml:mo>
789 <mml:mrow>
790 <mml:mfenced open="" close="">
791 <mml:msub><mml:mi mathvariant="italic">zoom</mml:mi>
792 <mml:mi mathvariant="italic">x</mml:mi>
793 </mml:msub>
794 </mml:mfenced>
795 <mml:mo>⁡</mml:mo>
796 <mml:mfenced open="(" close=")">
797 <mml:mrow>
798 <mml:mi mathvariant="italic">n</mml:mi>
799 <mml:mo>+</mml:mo>
800 <mml:mn>1</mml:mn>
801 </mml:mrow>
802 </mml:mfenced>
803 </mml:mrow>
804 </mml:mrow>
805 <mml:mrow>
806 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
807 <mml:mi mathvariant="italic">r</mml:mi>
808 </mml:msub>
809 <mml:mo>+</mml:mo>
810 <mml:mrow>
811 <mml:mfenced open="" close="">
812 <mml:msub><mml:mi mathvariant="italic">zoom</mml:mi>
813 <mml:mi mathvariant="italic">y</mml:mi>
814 </mml:msub>
815 </mml:mfenced>
816 <mml:mo>⁡</mml:mo>
817 <mml:mfenced open="(" close=")">
818 <mml:mrow>
819 <mml:mi mathvariant="italic">m</mml:mi>
820 <mml:mo>+</mml:mo>
821 <mml:mn>1</mml:mn>
822 </mml:mrow>
823 </mml:mfenced>
824 </mml:mrow>
825 </mml:mrow>
826 </mml:mfenced>
827 </mml:math></div><p>
828 </p><p>
829 </p><p>
830 where
831 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
832
833 <mml:msub><mml:mi mathvariant="italic">zoom</mml:mi>
834 <mml:mi mathvariant="italic">x</mml:mi>
835 </mml:msub>
836 </mml:math>
837 is the value of <code class="constant">GL_ZOOM_X</code> and
838 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
839
840 <mml:msub><mml:mi mathvariant="italic">zoom</mml:mi>
841 <mml:mi mathvariant="italic">y</mml:mi>
842 </mml:msub>
843 </mml:math>
844 is the value of <code class="constant">GL_ZOOM_Y</code>.
845 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p>
846 <code class="constant">GL_BGR</code> and <code class="constant">GL_BGRA</code> are only valid for <em class="parameter"><code>format</code></em> if the GL
847 version is 1.2 or greater.
848 </p><p>
849 <code class="constant">GL_UNSIGNED_BYTE_3_3_2</code>,
850 <code class="constant">GL_UNSIGNED_BYTE_2_3_3_REV</code>,
851 <code class="constant">GL_UNSIGNED_SHORT_5_6_5</code>,
852 <code class="constant">GL_UNSIGNED_SHORT_5_6_5_REV</code>,
853 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4</code>,
854 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4_REV</code>,
855 <code class="constant">GL_UNSIGNED_SHORT_5_5_5_1</code>,
856 <code class="constant">GL_UNSIGNED_SHORT_1_5_5_5_REV</code>,
857 <code class="constant">GL_UNSIGNED_INT_8_8_8_8</code>,
858 <code class="constant">GL_UNSIGNED_INT_8_8_8_8_REV</code>,
859 <code class="constant">GL_UNSIGNED_INT_10_10_10_2</code>, and
860 <code class="constant">GL_UNSIGNED_INT_2_10_10_10_REV</code> are only valid for <em class="parameter"><code>type</code></em> if the
861 GL version is 1.2 or greater.
862 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
863 <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 one of
864 the accepted values.
865 </p><p>
866 <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>type</code></em> is <code class="constant">GL_BITMAP</code> and
867 <em class="parameter"><code>format</code></em> is not either <code class="constant">GL_COLOR_INDEX</code> or <code class="constant">GL_STENCIL_INDEX</code>.
868 </p><p>
869 <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.
870 </p><p>
871 <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>
872 and there is no stencil buffer.
873 </p><p>
874 <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>format</code></em> is
875 <code class="constant">GL_RED</code>,
876 <code class="constant">GL_GREEN</code>,
877 <code class="constant">GL_BLUE</code>,
878 <code class="constant">GL_ALPHA</code>,
879 <code class="constant">GL_RGB</code>,
880 <code class="constant">GL_RGBA</code>,
881 <code class="constant">GL_BGR</code>,
882 <code class="constant">GL_BGRA</code>,
883 <code class="constant">GL_LUMINANCE</code>,
884 or
885 <code class="constant">GL_LUMINANCE_ALPHA</code>,
886 and the GL is in color index mode.
887 </p><p>
888 <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>format</code></em> is one of
889 <code class="constant">GL_UNSIGNED_BYTE_3_3_2</code>,
890 <code class="constant">GL_UNSIGNED_BYTE_2_3_3_REV</code>,
891 <code class="constant">GL_UNSIGNED_SHORT_5_6_5</code>, or
892 <code class="constant">GL_UNSIGNED_SHORT_5_6_5_REV</code>
893 and <em class="parameter"><code>format</code></em> is not <code class="constant">GL_RGB</code>.
894 </p><p>
895 <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>format</code></em> is one of
896 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4</code>,
897 <code class="constant">GL_UNSIGNED_SHORT_4_4_4_4_REV</code>,
898 <code class="constant">GL_UNSIGNED_SHORT_5_5_5_1</code>,
899 <code class="constant">GL_UNSIGNED_SHORT_1_5_5_5_REV</code>,
900 <code class="constant">GL_UNSIGNED_INT_8_8_8_8</code>,
901 <code class="constant">GL_UNSIGNED_INT_8_8_8_8_REV</code>,
902 <code class="constant">GL_UNSIGNED_INT_10_10_10_2</code>, or
903 <code class="constant">GL_UNSIGNED_INT_2_10_10_10_REV</code>
904 and <em class="parameter"><code>format</code></em> is neither <code class="constant">GL_RGBA</code> nor <code class="constant">GL_BGRA</code>.
905 </p><p>
906 <code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to the
907 <code class="constant">GL_PIXEL_UNPACK_BUFFER</code> target and the buffer object's data store is currently mapped.
908 </p><p>
909 <code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to the
910 <code class="constant">GL_PIXEL_UNPACK_BUFFER</code> target and the data would be unpacked from the buffer
911 object such that the memory reads required would exceed the data store size.
912 </p><p>
913 <code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to the
914 <code class="constant">GL_PIXEL_UNPACK_BUFFER</code> target and <em class="parameter"><code>data</code></em> is not evenly divisible
915 into the number of bytes needed to store in memory a datum indicated by <em class="parameter"><code>type</code></em>.
916 </p><p>
917 <code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glDrawPixels</code>
918 is executed between the execution of <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a>
919 and the corresponding execution of <a class="citerefentry" href="glEnd.xml"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>.
920 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p>
921 <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_CURRENT_RASTER_POSITION</code>
922 </p><p>
923 <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_CURRENT_RASTER_POSITION_VALID</code>
924 </p><p>
925 <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_PIXEL_UNPACK_BUFFER_BINDING</code>
926 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
927 <a class="citerefentry" href="glAlphaFunc.xml"><span class="citerefentry"><span class="refentrytitle">glAlphaFunc</span></span></a>,
928 <a class="citerefentry" href="glBlendFunc.xml"><span class="citerefentry"><span class="refentrytitle">glBlendFunc</span></span></a>,
929 <a class="citerefentry" href="glCopyPixels.xml"><span class="citerefentry"><span class="refentrytitle">glCopyPixels</span></span></a>,
930 <a class="citerefentry" href="glDepthFunc.xml"><span class="citerefentry"><span class="refentrytitle">glDepthFunc</span></span></a>,
931 <a class="citerefentry" href="glLogicOp.xml"><span class="citerefentry"><span class="refentrytitle">glLogicOp</span></span></a>,
932 <a class="citerefentry" href="glPixelMap.xml"><span class="citerefentry"><span class="refentrytitle">glPixelMap</span></span></a>,
933 <a class="citerefentry" href="glPixelStore.xml"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a>,
934 <a class="citerefentry" href="glPixelTransfer.xml"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a>,
935 <a class="citerefentry" href="glPixelZoom.xml"><span class="citerefentry"><span class="refentrytitle">glPixelZoom</span></span></a>,
936 <a class="citerefentry" href="glRasterPos.xml"><span class="citerefentry"><span class="refentrytitle">glRasterPos</span></span></a>,
937 <a class="citerefentry" href="glReadPixels.xml"><span class="citerefentry"><span class="refentrytitle">glReadPixels</span></span></a>,
938 <a class="citerefentry" href="glScissor.xml"><span class="citerefentry"><span class="refentrytitle">glScissor</span></span></a>,
939 <a class="citerefentry" href="glStencilFunc.xml"><span class="citerefentry"><span class="refentrytitle">glStencilFunc</span></span></a>,
940 <a class="citerefentry" href="glWindowPos.xml"><span class="citerefentry"><span class="refentrytitle">glWindowPos</span></span></a>
941 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p>
942 Copyright <span class="trademark"></span>© 1991-2006
943 Silicon Graphics, Inc. This document is licensed under the SGI
944 Free Software B License. For details, see
945 <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>.
946 </p></div></div></body></html>