<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
<html
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:mml="http://www.w3.org/1998/Math/MathML"
><head><title>glDrawPixels</title><link rel="stylesheet" href="style.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.59.1"/><link rel="home" href="index.xml" title="PyOpenGL 2.0.1.07 Man Pages"/><link rel="up" href="reference-GL.xml" title="GL"/><link rel="previous" href="glDrawElements.3G.xml" title="glDrawElements"/><link rel="next" href="glDrawRangeElements.3G.xml" title="glDrawRangeElements"/></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">glDrawPixels</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="glDrawElements.3G.xml">Prev</a> </td><th width="60%" align="center">GL</th><td width="20%" align="right"> <a accesskey="n" href="glDrawRangeElements.3G.xml">Next</a></td></tr></table><hr/></div><div class="refentry" lang="en"><a name="glDrawPixels.3G"/><div class="titlepage"/><div class="refnamediv"><a name="glDrawPixels.3G-name"/><h2>Name</h2><p>glDrawPixels, glDrawPixelsb, glDrawPixelsf, glDrawPixelsi, glDrawPixelss, glDrawPixelsub, glDrawPixelsui, glDrawPixelsus &#8212; write a block of pixels to the frame buffer</p></div><div class="refsynopsisdiv"><a name="glDrawPixels.3G-c_spec"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void <tt>glDrawPixels</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLsizei <i><tt>width</tt></i>, GLsizei <i><tt>height</tt></i>, GLenum <i><tt>format</tt></i>, GLenum <i><tt>type</tt></i>, const GLvoid *<i><tt>pixels</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glDrawPixels.3G-python_spec"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glDrawPixels</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>width</tt></i>, <i><tt>height</tt></i>, <i><tt>format</tt></i>, <i><tt>type</tt></i>, <i><tt>pixels</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glDrawPixelsb</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>format</tt></i>, <i><tt>pixels</tt></i>[][][]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glDrawPixelsf</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>format</tt></i>, <i><tt>pixels</tt></i>[][][]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glDrawPixelsi</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>format</tt></i>, <i><tt>pixels</tt></i>[][][]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glDrawPixelss</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>format</tt></i>, <i><tt>pixels</tt></i>[][][]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glDrawPixelsub</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>format</tt></i>, <i><tt>pixels</tt></i>[][][]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glDrawPixelsui</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>format</tt></i>, <i><tt>pixels</tt></i>[][][]) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glDrawPixelsus</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>format</tt></i>, <i><tt>pixels</tt></i>[][][]) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glDrawPixels.3G-parameters"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>width</tt></i>, <i><tt>height</tt></i></span></dt><dd>
						Specify the dimensions of the pixel rectangle to be written into the frame buffer.
					</dd><dt><span class="term"><i><tt>format</tt></i></span></dt><dd>
						Specifies the of the pixel data. Symbolic constants <tt>GL_COLOR_INDEX</tt>,
						<tt>GL_STENCIL_INDEX</tt>, <tt>GL_DEPTH_COMPONENT</tt>,
						<tt>GL_RGB</tt>, <tt>GL_BGR</tt>, <tt>GL_RGBA</tt>,
						<tt>GL_BGRA</tt>, <tt>GL_RED</tt>, <tt>GL_GREEN</tt>,
						<tt>GL_BLUE</tt>, <tt>GL_ALPHA</tt>, <tt>GL_LUMINANCE</tt>, and
						<tt>GL_LUMINANCE_ALPHA</tt> are accepted.
					</dd><dt><span class="term"><i><tt>type</tt></i></span></dt><dd>
						Specifies the data type for <i><tt>pixels</tt></i>. Symbolic constants
						<tt>GL_UNSIGNED_BYTE</tt>, <tt>GL_BYTE</tt>, <tt>GL_BITMAP</tt>,
						<tt>GL_UNSIGNED_SHORT</tt>, <tt>GL_SHORT</tt>,
						<tt>GL_UNSIGNED_INT</tt>, <tt>GL_INT</tt>, <tt>GL_FLOAT</tt>,
						<tt>GL_UNSIGNED_BYTE_3_3_2</tt>, <tt>GL_UNSIGNED_BYTE_2_3_3_REV</tt>,
						<tt>GL_UNSIGNED_SHORT_5_6_5</tt>, <tt>GL_UNSIGNED_SHORT_5_6_5_REV</tt>,
						<tt>GL_UNSIGNED_SHORT_4_4_4_4</tt>, <tt>GL_UNSIGNED_SHORT_4_4_4_4_REV</tt>,
						<tt>GL_UNSIGNED_SHORT_5_5_5_1</tt>, <tt>GL_UNSIGNED_SHORT_1_5_5_5_REV</tt>,
						<tt>GL_UNSIGNED_INT_8_8_8_8</tt>, <tt>GL_UNSIGNED_INT_8_8_8_8_REV</tt>,
						<tt>GL_UNSIGNED_INT_10_10_10_2</tt>, and <tt>GL_UNSIGNED_INT_2_10_10_10_REV</tt>
						are accepted.
					</dd><dt><span class="term"><i><tt>pixels</tt></i></span></dt><dd>
						Specifies a pointer to the pixel data.
					</dd></dl></div></div><div class="refsect1" lang="en"><a name="glDrawPixels.3G-description"/><h2>Description</h2><p>
			<tt>glDrawPixels</tt> reads pixel data from memory and writes it into the frame buffer
		</p><p>
			relative to the current raster position, provided that the raster position is valid. Use
		</p><p>
			<tt>glRasterPos</tt> to set the current raster position; use <tt>glGet</tt> with argument <tt>GL_CURRENT_RASTER_POSITION_VALID</tt> to determine
			if the specified raster position is valid, and <tt>glGet</tt> with argument
			<tt>GL_CURRENT_RASTER_POSITION</tt> to query the raster position.
		</p><p>
			Several parameters define the encoding of pixel data in memory and control the processing of the pixel data before it
			is placed in the frame buffer. These parameters are set with four commands: <tt>glPixelStore</tt>, <tt>glPixelTransfer</tt>, <tt>glPixelMap</tt>, and <a href="glPixelZoom.3G.xml"><tt>glPixelZoom</tt></a>. This reference
			page describes the effects on <tt>glDrawPixels</tt> of many, but not all, of the parameters specified by
			these four commands.
		</p><p>
			Data is read from <i><tt>pixels</tt></i> as a sequence of signed or unsigned bytes, signed or unsigned shorts,
			signed or unsigned integers, or single-precision floating-point values, depending on <i><tt>type</tt></i>. When
			<i><tt>type</tt></i> is one of <tt>GL_UNSIGNED_BYTE</tt>, <tt>GL_BYTE</tt>,
			<tt>GL_UNSIGNED_SHORT</tt>, <tt>GL_SHORT</tt>, <tt>GL_UNSIGNED_INT</tt>,
			<tt>GL_INT</tt>, or <tt>GL_FLOAT</tt> each of these bytes, shorts, integers, or floating-point
			values is interpreted as one color or depth component, or one index, depending on <i><tt>format</tt></i>. When
			<i><tt>type</tt></i> is one of <tt>GL_UNSIGNED_BYTE_3_3_2</tt>,
			<tt>GL_UNSIGNED_SHORT_5_6_5</tt>, <tt>GL_UNSIGNED_SHORT_4_4_4_4</tt>,
			<tt>GL_UNSIGNED_SHORT_5_5_5_1</tt>, <tt>GL_UNSIGNED_INT_8_8_8_8</tt>,
			<tt>GL_UNSIGNED_INT_10_10_10_2</tt>, each unsigned value is interpreted as containing all the components
			for a single pixel, with the color components arranged according to <i><tt>format</tt></i>. When
			<i><tt>type</tt></i> is one of <tt>GL_UNSIGNED_BYTE_2_3_3_REV</tt>,
			<tt>GL_UNSIGNED_SHORT_5_6_5_REV</tt>, <tt>GL_UNSIGNED_SHORT_4_4_4_4_REV</tt>,
			<tt>GL_UNSIGNED_SHORT_1_5_5_5_REV</tt>, <tt>GL_UNSIGNED_INT_8_8_8_8_REV</tt>,
			<tt>GL_UNSIGNED_INT_2_10_10_10_REV</tt>, each unsigned value is interpreted as containing all color
			components, specified by <i><tt>format</tt></i>, for a single pixel in a reversed order. Indices are always
			treated individually. Color components are treated as groups of one, two, three, or four values, again based on
			<i><tt>format</tt></i>. Both individual indices and groups of components are referred to as pixels. If
			<i><tt>type</tt></i> is <tt>GL_BITMAP</tt>, the data must be unsigned bytes, and
			<i><tt>format</tt></i> must be either <tt>GL_COLOR_INDEX</tt> or
			<tt>GL_STENCIL_INDEX</tt>. Each unsigned byte is treated as eight 1-bit pixels, with bit ordering
			determined by <tt>GL_UNPACK_LSB_FIRST</tt> (see <a href="glPixelStore.3G.xml">glPixelStore</a>).
		</p><p>
			<i><tt>width</tt></i><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:mo>×</mml:mo>
					</mml:mrow>
				</mml:math><i><tt>height</tt></i> pixels are read from memory, starting at location
			<i><tt>pixels</tt></i>. By default, these pixels are taken from adjacent memory locations, except that after all
			<i><tt>width</tt></i> pixels are read, the read pointer is advanced to the next four-byte boundary. The
			four-byte row alignment is specified by <tt>glPixelStore</tt> with argument
			<tt>GL_UNPACK_ALIGNMENT</tt>, and it can be set to one, two, four, or eight bytes. Other pixel store
			parameters specify different read pointer advancements, both before the first pixel is read and after all
			<i><tt>width</tt></i> pixels are read. See the <tt>glPixelStore</tt> reference
			page for details on these options.
		</p><p>
			The <i><tt>width</tt></i><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:mo>×</mml:mo>
					</mml:mrow>
				</mml:math><i><tt>height</tt></i> pixels that are read from memory are each operated on in the same way,
			based on the values of several parameters specified by <tt>glPixelTransfer</tt> and
			<tt>glPixelMap</tt>. The details of these operations, as well as the target buffer into
			which the pixels are drawn, are specific to the of the pixels, as specified by <i><tt>format</tt></i>.
			<i><tt>format</tt></i> can assume one of 13 symbolic values:
		</p><div class="variablelist"><dl><dt><span class="term"><tt>GL_COLOR_INDEX</tt></span></dt><dd><p>
						Each pixel is a single value, a color index. It is converted to fixed-point , with an unspecified number of
						bits to the right of the binary point, regardless of the memory data type. Floating-point values convert to
						true fixed-point values. Signed and unsigned integer data is converted with all fraction bits set to 0.
						Bitmap data convert to either 0 or 1.
					</p><p>
						Each fixed-point index is then shifted left by <tt>GL_INDEX_SHIFT</tt> bits and added to
						<tt>GL_INDEX_OFFSET</tt>. If <tt>GL_INDEX_SHIFT</tt> is negative, the shift is to
						the right. In either case, zero bits fill otherwise unspecified bit locations in the result.
					</p><p>
						If the GL is in RGBA mode, the resulting index is converted to an RGBA pixel with the help of the
						<tt>GL_PIXEL_MAP_I_TO_R</tt>, <tt>GL_PIXEL_MAP_I_TO_G</tt>,
						<tt>GL_PIXEL_MAP_I_TO_B</tt>, and <tt>GL_PIXEL_MAP_I_TO_A</tt> tables. If the GL is
						in color index mode, and if <tt>GL_MAP_COLOR</tt> is true, the index is replaced with the value
						that it references in lookup table <tt>GL_PIXEL_MAP_I_TO_I</tt>. Whether the lookup replacement
						of the index is done or not, the integer part of the index is then ANDed with <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mrow>
									<mml:msup>
										<mml:mn>2</mml:mn>
										<mml:mi>b</mml:mi>
									</mml:msup>
									<mml:mn>-1</mml:mn>
								</mml:mrow>
							</mml:math>, where <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mi>b</mml:mi>
							</mml:math> is the number of bits in a color index buffer.
					</p><p>
						The GL then converts the resulting indices or RGBA colors to fragments by attaching the current raster
						position <i><tt>z</tt></i> coordinate and texture coordinates to each pixel, then assigning
						<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mi>x</mml:mi>
							</mml:math> and <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mi>y</mml:mi>
							</mml:math> window coordinates to the <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mi>n</mml:mi>
							</mml:math>th fragment such that <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mrow>
									<mml:msub>
										<mml:mi>x</mml:mi>
										<mml:mi>n</mml:mi>
									</mml:msub>
									<mml:mo>=</mml:mo>
									<mml:msub>
										<mml:mi>x</mml:mi>
										<mml:mi>r</mml:mi>
									</mml:msub>
									<mml:mo>+</mml:mo>
									<mml:mi>n</mml:mi>
									<mml:mi>mod</mml:mi>
									<mml:mi>width</mml:mi>
								</mml:mrow>
							</mml:math> <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mrow>
									<mml:msub>
										<mml:mi>y</mml:mi>
										<mml:mi>n</mml:mi>
									</mml:msub>
									<mml:mo>=</mml:mo>
									<mml:msub>
										<mml:mi>y</mml:mi>
										<mml:mi>r</mml:mi>
									</mml:msub>
									<mml:mo>+</mml:mo>
									<mml:mo>&#8970;</mml:mo>
									<mml:mi>n</mml:mi>
									<mml:mo>/</mml:mo>
									<mml:mi>width</mml:mi>
									<mml:mo>&#8971;</mml:mo>
								</mml:mrow>
							</mml:math>
					</p><p>
						where (<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mrow>
									<mml:msub>
										<mml:mi>x</mml:mi>
										<mml:mi>r</mml:mi>
									</mml:msub>
									<mml:msub>
										<mml:mi>y</mml:mi>
										<mml:mi>r</mml:mi>
									</mml:msub>
								</mml:mrow>
							</mml:math>) is the current raster position. These pixel fragments are then treated just like the
						fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment
						operations are applied before the fragments are written to the frame buffer.
					</p></dd><dt><span class="term"><tt>GL_STENCIL_INDEX</tt></span></dt><dd><p>
						Each pixel is a single value, a stencil index. It is converted to fixed-point , with an unspecified number
						of bits to the right of the binary point, regardless of the memory data type. Floating-point values convert
						to true fixed-point values. Signed and unsigned integer data is converted with all fraction bits set to 0.
						Bitmap data convert to either 0 or 1.
					</p><p>
						Each fixed-point index is then shifted left by <tt>GL_INDEX_SHIFT</tt> bits, and added to
						<tt>GL_INDEX_OFFSET</tt>. If <tt>GL_INDEX_SHIFT</tt> is negative, the shift is to
						the right. In either case, zero bits fill otherwise unspecified bit locations in the result. If
						<tt>GL_MAP_STENCIL</tt> is true, the index is replaced with the value that it references in
						lookup table <tt>GL_PIXEL_MAP_S_TO_S</tt>. Whether the lookup replacement of the index is done
						or not, the integer part of the index is then ANDed with <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mrow>
									<mml:msup>
										<mml:mn>2</mml:mn>
										<mml:mi>b</mml:mi>
									</mml:msup>
									<mml:mn>-1</mml:mn>
								</mml:mrow>
							</mml:math>, where <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mi>b</mml:mi>
							</mml:math> is the number of bits in the stencil buffer. The resulting stencil indices are then
						written to the stencil buffer such that the <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mi>n</mml:mi>
							</mml:math>th index is written to location
					</p></dd></dl></div><p>
			<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:msub>
							<mml:mi>x</mml:mi>
							<mml:mi>n</mml:mi>
						</mml:msub>
						<mml:mo>=</mml:mo>
						<mml:msub>
							<mml:mi>x</mml:mi>
							<mml:mi>r</mml:mi>
						</mml:msub>
						<mml:mo>+</mml:mo>
						<mml:mi>n</mml:mi>
						<mml:mi>mod</mml:mi>
						<mml:mi>width</mml:mi>
					</mml:mrow>
				</mml:math> <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:msub>
							<mml:mi>y</mml:mi>
							<mml:mi>n</mml:mi>
						</mml:msub>
						<mml:mo>=</mml:mo>
						<mml:msub>
							<mml:mi>y</mml:mi>
							<mml:mi>r</mml:mi>
						</mml:msub>
						<mml:mo>+</mml:mo>
						<mml:mo>&#8970;</mml:mo>
						<mml:mi>n</mml:mi>
						<mml:mo>/</mml:mo>
						<mml:mi>width</mml:mi>
						<mml:mo>&#8971;</mml:mo>
					</mml:mrow>
				</mml:math>
		</p><p>
			where (<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:msub>
							<mml:mi>x</mml:mi>
							<mml:mi>r</mml:mi>
						</mml:msub>
						<mml:msub>
							<mml:mi>y</mml:mi>
							<mml:mi>r</mml:mi>
						</mml:msub>
					</mml:mrow>
				</mml:math>) is the current raster position. Only the pixel ownership test, the scissor test, and the stencil
			writemask affect these write operations.
		</p><div class="variablelist"><dl><dt><span class="term"><tt>GL_DEPTH_COMPONENT</tt></span></dt><dd><p>
						Each pixel is a single-depth component. Floating-point data is converted directly to an internal
						floating-point with unspecified precision. Signed integer data is mapped linearly to the internal
						floating-point such that the most positive representable integer value maps to 1.0, and the most negative
						representable value maps to -1.0. Unsigned integer data is mapped similarly: the largest integer value maps
						to 1.0, and 0 maps to 0.0. The resulting floating-point depth value is then multiplied by
						<tt>GL_DEPTH_SCALE</tt> and added to <tt>GL_DEPTH_BIAS</tt>. The result is clamped
						to the range [0,1].
					</p><p>
						The GL then converts the resulting depth components to fragments by attaching the current raster position
						color or color index and texture coordinates to each pixel, then assigning <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mi>x</mml:mi>
							</mml:math> and <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mi>y</mml:mi>
							</mml:math> window coordinates to the <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mi>n</mml:mi>
							</mml:math>th fragment such that
					</p></dd></dl></div><p>
			<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:msub>
							<mml:mi>x</mml:mi>
							<mml:mi>n</mml:mi>
						</mml:msub>
						<mml:mo>=</mml:mo>
						<mml:msub>
							<mml:mi>x</mml:mi>
							<mml:mi>r</mml:mi>
						</mml:msub>
						<mml:mo>+</mml:mo>
						<mml:mi>n</mml:mi>
						<mml:mi>mod</mml:mi>
						<mml:mi>width</mml:mi>
					</mml:mrow>
				</mml:math> <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:msub>
							<mml:mi>y</mml:mi>
							<mml:mi>n</mml:mi>
						</mml:msub>
						<mml:mo>=</mml:mo>
						<mml:msub>
							<mml:mi>y</mml:mi>
							<mml:mi>r</mml:mi>
						</mml:msub>
						<mml:mo>+</mml:mo>
						<mml:mo>&#8970;</mml:mo>
						<mml:mi>n</mml:mi>
						<mml:mo>/</mml:mo>
						<mml:mi>width</mml:mi>
						<mml:mo>&#8971;</mml:mo>
					</mml:mrow>
				</mml:math>
		</p><p>
			where (<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:msub>
							<mml:mi>x</mml:mi>
							<mml:mi>r</mml:mi>
						</mml:msub>
						<mml:msub>
							<mml:mi>y</mml:mi>
							<mml:mi>r</mml:mi>
						</mml:msub>
					</mml:mrow>
				</mml:math>) is the current raster position. These pixel fragments are then treated just like the fragments
			generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied
			before the fragments are written to the frame buffer.
		</p><div class="variablelist"><dl><dt><span class="term"><tt>GL_BGRA</tt>, </span><span class="term"><tt>GL_RGBA</tt></span></dt><dd><p>
						Each pixel is a four-component group: for <tt>GL_RGBA</tt>, the red component is first,
						followed by green, followed by blue, followed by alpha; for <tt>GL_BGRA</tt> the order is blue,
						green, red and then alpha. Floating-point values are converted directly to an internal floating-point with
						unspecified precision. Signed integer values are mapped linearly to the internal floating-point such that
						the most positive representable integer value maps to 1.0, and the most negative representable value maps
						to -1.0. (Note that this mapping does not convert 0 precisely to 0.0.) Unsigned integer data is mapped
						similarly: the largest integer value maps to 1.0, and 0 maps to 0.0. The resulting floating-point color
						values are then multiplied by <tt>GL_c_SCALE</tt> and added to <tt>GL_c_BIAS</tt>,
						where <i><tt>c</tt></i> is RED, GREEN, BLUE, and ALPHA for the respective color components. The
						results are clamped to the range [0,1].
					</p><p>
						If <tt>GL_MAP_COLOR</tt> is true, each color component is scaled by the size of lookup table
						<tt>GL_PIXEL_MAP_c_TO_c</tt>, then replaced by the value that it references in that table.
						<i><tt>c</tt></i> is R, G, B, or A respectively.
					</p><p>
						The GL then converts the resulting RGBA colors to fragments by attaching the current raster position
						<i><tt>z</tt></i> coordinate and texture coordinates to each pixel, then assigning <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mi>x</mml:mi>
							</mml:math> and <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mi>y</mml:mi>
							</mml:math> window coordinates to the <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mi>n</mml:mi>
							</mml:math>th fragment such that
					</p></dd></dl></div><p>
			<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:msub>
							<mml:mi>x</mml:mi>
							<mml:mi>n</mml:mi>
						</mml:msub>
						<mml:mo>=</mml:mo>
						<mml:msub>
							<mml:mi>x</mml:mi>
							<mml:mi>r</mml:mi>
						</mml:msub>
						<mml:mo>+</mml:mo>
						<mml:mi>n</mml:mi>
						<mml:mi>mod</mml:mi>
						<mml:mi>width</mml:mi>
					</mml:mrow>
				</mml:math> <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:msub>
							<mml:mi>y</mml:mi>
							<mml:mi>n</mml:mi>
						</mml:msub>
						<mml:mo>=</mml:mo>
						<mml:msub>
							<mml:mi>y</mml:mi>
							<mml:mi>r</mml:mi>
						</mml:msub>
						<mml:mo>+</mml:mo>
						<mml:mo>&#8970;</mml:mo>
						<mml:mi>n</mml:mi>
						<mml:mo>/</mml:mo>
						<mml:mi>width</mml:mi>
						<mml:mo>&#8971;</mml:mo>
					</mml:mrow>
				</mml:math>
		</p><p>
			where (<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:msub>
							<mml:mi>x</mml:mi>
							<mml:mi>r</mml:mi>
						</mml:msub>
						<mml:msub>
							<mml:mi>y</mml:mi>
							<mml:mi>r</mml:mi>
						</mml:msub>
					</mml:mrow>
				</mml:math>) is the current raster position. These pixel fragments are then treated just like the fragments
			generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied
			before the fragments are written to the frame buffer.
		</p><div class="variablelist"><dl><dt><span class="term"><tt>GL_RED</tt></span></dt><dd>
						Each pixel is a single red component. This component is converted to the internal floating-point in the
						same way the red component of an RGBA pixel is. It is then converted to an RGBA pixel with green and blue
						set to 0, and alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA
						pixel.
					</dd><dt><span class="term"><tt>GL_GREEN</tt></span></dt><dd>
						Each pixel is a single green component. This component is converted to the internal floating-point in the
						same way the green component of an RGBA pixel is. It is then converted to an RGBA pixel with red and blue
						set to 0, and alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA
						pixel.
					</dd><dt><span class="term"><tt>GL_BLUE</tt></span></dt><dd>
						Each pixel is a single blue component. This component is converted to the internal floating-point in the
						same way the blue component of an RGBA pixel is. It is then converted to an RGBA pixel with red and green
						set to 0, and alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA
						pixel.
					</dd><dt><span class="term"><tt>GL_ALPHA</tt></span></dt><dd>
						Each pixel is a single alpha component. This component is converted to the internal floating-point in the
						same way the alpha component of an RGBA pixel is. It is then converted to an RGBA pixel with red, green,
						and blue set to 0. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
					</dd><dt><span class="term"><tt>GL_BGR</tt>, </span><span class="term"><tt>GL_RGB</tt></span></dt><dd>
						Each pixel is a three-component group: red first, followed by green, followed by blue; for
						<tt>GL_BGR</tt>, the first component is blue, followed by green and then red. Each component is
						converted to the internal floating-point in the same way the red, green, and blue components of an RGBA
						pixel are. The color triple is converted to an RGBA pixel with alpha set to 1. After this conversion, the
						pixel is treated as if it had been read as an RGBA pixel.
					</dd><dt><span class="term"><tt>GL_LUMINANCE</tt></span></dt><dd>
						Each pixel is a single luminance component. This component is converted to the internal floating-point in
						the same way the red component of an RGBA pixel is. It is then converted to an RGBA pixel with red, green,
						and blue set to the converted luminance value, and alpha set to 1. After this conversion, the pixel is
						treated as if it had been read as an RGBA pixel.
					</dd><dt><span class="term"><tt>GL_LUMINANCE_ALPHA</tt></span></dt><dd>
						Each pixel is a two-component group: luminance first, followed by alpha. The two components are converted
						to the internal floating-point in the same way the red component of an RGBA pixel is. They are then
						converted to an RGBA pixel with red, green, and blue set to the converted luminance value, and alpha set to
						the converted alpha value. After this conversion, the pixel is treated as if it had been read as an RGBA
						pixel.
					</dd></dl></div><p>
			The following table summarizes the meaning of the valid constants for the <i><tt>type</tt></i> parameter:
		</p><div class="informaltable"><table border="1"><colgroup><col/><col/><col/></colgroup><tbody><tr><td><span class="bold"><b>Type</b></span></td><td><span class="bold"><b>Corresponding Type</b></span></td><td> </td></tr><tr><td><tt>GL_UNSIGNED_BYTE</tt></td><td>unsigned 8-bit integer</td><td> </td></tr><tr><td><tt>GL_BYTE</tt></td><td>signed 8-bit integer</td><td> </td></tr><tr><td><tt>GL_BITMAP</tt></td><td>single bits in unsigned 8-bit integers</td><td> </td></tr><tr><td><tt>GL_UNSIGNED_SHORT</tt></td><td>unsigned 16-bit integer</td><td> </td></tr><tr><td><tt>GL_SHORT</tt></td><td>signed 16-bit integer</td><td> </td></tr><tr><td><tt>GL_UNSIGNED_INT</tt></td><td>unsigned 32-bit integer</td><td> </td></tr><tr><td><tt>GL_INT</tt></td><td>32-bit integer</td><td> </td></tr><tr><td><tt>GL_FLOAT</tt></td><td>single-precision floating-point</td><td> </td></tr><tr><td><tt>GL_UNSIGNED_BYTE_3_3_2</tt></td><td>unsigned 8-bit integer</td><td> </td></tr><tr><td><tt>GL_UNSIGNED_BYTE_2_3_3_REV</tt></td><td>unsigned 8-bit integer with reversed component ordering</td><td> </td></tr><tr><td><tt>GL_UNSIGNED_SHORT_5_6_5</tt></td><td>unsigned 16-bit integer</td><td> </td></tr><tr><td><tt>GL_UNSIGNED_SHORT_5_6_5_REV</tt></td><td>unsigned 16-bit integer with reversed component ordering</td><td> </td></tr><tr><td><tt>GL_UNSIGNED_SHORT_4_4_4_4</tt></td><td>unsigned 16-bit integer</td><td> </td></tr><tr><td><tt>GL_UNSIGNED_SHORT_4_4_4_4_REV</tt></td><td>unsigned 16-bit integer with reversed component ordering</td><td> </td></tr><tr><td><tt>GL_UNSIGNED_SHORT_5_5_5_1</tt></td><td>unsigned 16-bit integer</td><td> </td></tr><tr><td><tt>GL_UNSIGNED_SHORT_1_5_5_5_REV</tt></td><td>unsigned 16-bit integer with reversed component ordering</td><td> </td></tr><tr><td><tt>GL_UNSIGNED_INT_8_8_8_8</tt></td><td>unsigned 32-bit integer</td><td> </td></tr><tr><td><tt>GL_UNSIGNED_INT_8_8_8_8_REV</tt></td><td>unsigned 32-bit integer with reversed component ordering</td><td> </td></tr><tr><td><tt>GL_UNSIGNED_INT_10_10_10_2</tt></td><td>unsigned 32-bit integer</td><td> </td></tr><tr><td><tt>GL_UNSIGNED_INT_2_10_10_10_REV</tt></td><td>unsigned 32-bit integer with reversed component ordering</td><td> </td></tr></tbody></table></div><p>
			The rasterization described so far assumes pixel zoom factors of 1. If
		</p><p>
			<a href="glPixelZoom.3G.xml"><tt>glPixelZoom</tt></a> is used to change the <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mi>x</mml:mi>
				</mml:math> and <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mi>y</mml:mi>
				</mml:math> pixel zoom factors, pixels are converted to fragments as follows. If (<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:msub>
						<mml:mi>x</mml:mi>
						<mml:mi>r</mml:mi>
					</mml:msub>
				</mml:math>, <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:msub>
						<mml:mi>y</mml:mi>
						<mml:mi>r</mml:mi>
					</mml:msub>
				</mml:math>) is the current raster position, and a given pixel is in the <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mi>n</mml:mi>
				</mml:math>th column and <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mi>m</mml:mi>
				</mml:math>th row of the pixel rectangle, then fragments are generated for pixels whose centers are in the
			rectangle with corners at (<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:msub>
							<mml:mi>x</mml:mi>
							<mml:mi>r</mml:mi>
						</mml:msub>
						<mml:mo>+</mml:mo>
						<mml:msub>
							<mml:mi>zoom</mml:mi>
							<mml:mi>x</mml:mi>
						</mml:msub>
						<mml:mi>n</mml:mi>
					</mml:mrow>
				</mml:math>, <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:msub>
							<mml:mi>y</mml:mi>
							<mml:mi>r</mml:mi>
						</mml:msub>
						<mml:mo>+</mml:mo>
						<mml:msub>
							<mml:mi>zoom</mml:mi>
							<mml:mi>y</mml:mi>
						</mml:msub>
						<mml:mi>m</mml:mi>
					</mml:mrow>
				</mml:math>) (<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:msub>
							<mml:mi>x</mml:mi>
							<mml:mi>r</mml:mi>
						</mml:msub>
						<mml:mo>+</mml:mo>
						<mml:msub>
							<mml:mi>zoom</mml:mi>
							<mml:mi>x</mml:mi>
						</mml:msub>
						<mml:mo>(</mml:mo>
						<mml:mi>n</mml:mi>
						<mml:mo>+</mml:mo>
						<mml:mn>1</mml:mn>
						<mml:mo>)</mml:mo>
					</mml:mrow>
				</mml:math>, <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:msub>
							<mml:mi>y</mml:mi>
							<mml:mi>r</mml:mi>
						</mml:msub>
						<mml:mo>+</mml:mo>
						<mml:msub>
							<mml:mi>zoom</mml:mi>
							<mml:mi>y</mml:mi>
						</mml:msub>
						<mml:mo>(</mml:mo>
						<mml:mi>m</mml:mi>
						<mml:mo>+</mml:mo>
						<mml:mn>1</mml:mn>
						<mml:mo>)</mml:mo>
					</mml:mrow>
				</mml:math>)
		</p><p>
			where <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:msub>
						<mml:mi>zoom</mml:mi>
						<mml:mi>x</mml:mi>
					</mml:msub>
				</mml:math> is the value of <tt>GL_ZOOM_X</tt> and <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:msub>
						<mml:mi>zoom</mml:mi>
						<mml:mi>y</mml:mi>
					</mml:msub>
				</mml:math> is the value of <tt>GL_ZOOM_Y</tt>.
		</p></div><div class="refsect1" lang="en"><a name="glDrawPixels.3G-notes"/><h2>Notes</h2><p>
			<tt>GL_BGR</tt> and <tt>GL_BGRA</tt> are only valid for <i><tt>format</tt></i> if the GL
			version is 1.2 or greater.
		</p><p>
			<tt>GL_UNSIGNED_BYTE_3_3_2</tt>, <tt>GL_UNSIGNED_BYTE_2_3_3_REV</tt>,
			<tt>GL_UNSIGNED_SHORT_5_6_5</tt>, <tt>GL_UNSIGNED_SHORT_5_6_5_REV</tt>,
			<tt>GL_UNSIGNED_SHORT_4_4_4_4</tt>, <tt>GL_UNSIGNED_SHORT_4_4_4_4_REV</tt>,
			<tt>GL_UNSIGNED_SHORT_5_5_5_1</tt>, <tt>GL_UNSIGNED_SHORT_1_5_5_5_REV</tt>,
			<tt>GL_UNSIGNED_INT_8_8_8_8</tt>, <tt>GL_UNSIGNED_INT_8_8_8_8_REV</tt>,
			<tt>GL_UNSIGNED_INT_10_10_10_2</tt>, and <tt>GL_UNSIGNED_INT_2_10_10_10_REV</tt> are only valid
			for <i><tt>type</tt></i> if the GL version is 1.2 or greater.
		</p></div><div class="refsect1" lang="en"><a name="glDrawPixels.3G-errors"/><h2>Errors</h2><p>
			<tt>GL_INVALID_VALUE</tt> is generated if either <i><tt>width</tt></i> or
			<i><tt>height</tt></i> is negative.
		</p><p>
			<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>format</tt></i> or <i><tt>type</tt></i> is
			not one of the accepted values.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if <i><tt>format</tt></i> is <tt>GL_RED</tt>,
			<tt>GL_GREEN</tt>, <tt>GL_BLUE</tt>, <tt>GL_ALPHA</tt>,
			<tt>GL_RGB</tt>, <tt>GL_RGBA</tt>, <tt>GL_BGR</tt>, <tt>GL_BGRA</tt>,
			<tt>GL_LUMINANCE</tt>, or <tt>GL_LUMINANCE_ALPHA</tt>, and the GL is in color index mode.
		</p><p>
			<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>type</tt></i> is <tt>GL_BITMAP</tt> and
			<i><tt>format</tt></i> is not either <tt>GL_COLOR_INDEX</tt> or
			<tt>GL_STENCIL_INDEX</tt>.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if <i><tt>format</tt></i> is
			<tt>GL_STENCIL_INDEX</tt> and there is no stencil buffer.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if <tt>glDrawPixels</tt> is executed between the
			execution of <a href="glBegin.3G.xml"><tt>glBegin</tt></a> and the corresponding execution of <a href="glBegin.3G.xml"><tt>glEnd</tt></a>.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if <i><tt>format</tt></i> is one
			<tt>GL_UNSIGNED_BYTE_3_3_2</tt>, <tt>GL_UNSIGNED_BYTE_2_3_3_REV</tt>,
			<tt>GL_UNSIGNED_SHORT_5_6_5</tt>, of <tt>GL_UNSIGNED_SHORT_5_6_5_REV</tt> and
			<i><tt>format</tt></i> is not <tt>GL_RGB</tt>.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if <i><tt>format</tt></i> is one of
			<tt>GL_UNSIGNED_SHORT_4_4_4_4</tt>, <tt>GL_UNSIGNED_SHORT_4_4_4_4_REV</tt>,
			<tt>GL_UNSIGNED_SHORT_5_5_5_1</tt>, <tt>GL_UNSIGNED_SHORT_1_5_5_5_REV</tt>,
			<tt>GL_UNSIGNED_INT_8_8_8_8</tt>, <tt>GL_UNSIGNED_INT_8_8_8_8_REV</tt>,
			<tt>GL_UNSIGNED_INT_10_10_10_2</tt>, or <tt>GL_UNSIGNED_INT_2_10_10_10_REV</tt> and
			<i><tt>format</tt></i> is neither <tt>GL_RGBA</tt> nor <tt>GL_BGRA</tt>.
		</p></div><div class="refsect1" lang="en"><a name="glDrawPixels.3G-associated_gets"/><h2>Associated Gets</h2><p>
			<tt>glGet</tt> with argument <tt>GL_CURRENT_RASTER_POSITION</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_CURRENT_RASTER_POSITION_VALID</tt>
		</p></div><div class="refsect1" lang="en"><a name="glDrawPixels.3G-see_also"/><h2>See Also</h2><p>
			<span class="simplelist"><a href="glAlphaFunc.3G.xml">glAlphaFunc</a>, <a href="glBlendFunc.3G.xml">glBlendFunc</a>, <a href="glCopyPixels.3G.xml">glCopyPixels</a>, <a href="glDepthFunc.3G.xml">glDepthFunc</a>, <a href="glLogicOp.3G.xml">glLogicOp</a>, <a href="glPixelMap.3G.xml">glPixelMap</a>, <a href="glPixelStore.3G.xml">glPixelStore</a>, <a href="glPixelTransfer.3G.xml">glPixelTransfer</a>, <a href="glPixelZoom.3G.xml">glPixelZoom</a>, <a href="glRasterPos.3G.xml">glRasterPos</a>, <a href="glReadPixels.3G.xml">glReadPixels</a>, <a href="glScissor.3G.xml">glScissor</a>, <a href="glStencilFunc.3G.xml">glStencilFunc</a></span>
		</p></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="glDrawElements.3G.xml">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-GL.xml">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="glDrawRangeElements.3G.xml">Next</a></td></tr><tr><td width="40%" align="left" valign="top">glDrawElements </td><td width="20%" align="center"><a accesskey="h" href="index.xml">Home</a></td><td width="40%" align="right" valign="top"> glDrawRangeElements</td></tr></table></div></body></html>