table of contents
GLREADPIXELS(3G) | [FIXME: manual] | GLREADPIXELS(3G) |
NAME¶
glReadPixels - read a block of pixels from the frame bufferC SPECIFICATION¶
void
glReadPixels(GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
GLvoid * data);
PARAMETERS¶
x, ySpecify the window coordinates of the first
pixel that is read from the frame buffer. This location is the lower left
corner of a rectangular block of pixels.
width, height
Specify the dimensions of the pixel rectangle.
width and height of one correspond to a single pixel.
format
Specifies the format of the pixel data. The
following symbolic values are accepted: GL_STENCIL_INDEX,
GL_DEPTH_COMPONENT, GL_DEPTH_STENCIL, GL_RED,
GL_GREEN, GL_BLUE, GL_RGB, GL_BGR, GL_RGBA,
and GL_BGRA.
type
Specifies the data type of the pixel data.
Must be one of GL_UNSIGNED_BYTE, GL_BYTE,
GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT,
GL_INT, GL_HALF_FLOAT, GL_FLOAT,
GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV,
GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV,
GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV,
GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV,
GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV,
GL_UNSIGNED_INT_10_10_10_2, GL_UNSIGNED_INT_2_10_10_10_REV,
GL_UNSIGNED_INT_24_8, GL_UNSIGNED_INT_10F_11F_11F_REV,
GL_UNSIGNED_INT_5_9_9_9_REV, or
GL_FLOAT_32_UNSIGNED_INT_24_8_REV.
data
Returns the pixel data.
DESCRIPTION¶
Stencil values are read from the stencil
buffer. Each index is converted to fixed point, shifted left or right
depending on the value and sign of GL_INDEX_SHIFT, and added to
GL_INDEX_OFFSET. If GL_MAP_STENCIL is GL_TRUE, indices
are replaced by their mappings in the table GL_PIXEL_MAP_S_TO_S.
GL_DEPTH_COMPONENT
Depth values are read from the depth buffer.
Each component is converted to floating point such that the minimum depth
value maps to 0 and the maximum value maps to 1. Each component is then
multiplied by GL_DEPTH_SCALE, added to GL_DEPTH_BIAS, and
finally clamped to the range 0 1.
GL_DEPTH_STENCIL
Values are taken from both the depth and
stencil buffers. The type parameter must be GL_UNSIGNED_INT_24_8
or GL_FLOAT_32_UNSIGNED_INT_24_8_REV.
GL_RED
GL_GREEN
GL_BLUE
GL_RGB
GL_BGR
GL_RGBA
GL_BGRA
Finally, the indices or components are converted to the proper format, as
specified by type. If format is GL_STENCIL_INDEX and
type is not GL_FLOAT, each index is masked with the mask value
given in the following table. If type is GL_FLOAT, then each
integer index is converted to single-precision floating-point format.
If format is GL_RED, GL_GREEN, GL_BLUE,
GL_RGB, GL_BGR, GL_RGBA, or GL_BGRA and
type is not GL_FLOAT, each component is multiplied by the
multiplier shown in the following table. If type is GL_FLOAT, then each
component is passed as is (or converted to the client's single-precision
floating-point format if it is different from the one used by the GL).
type | Index Mask | Component Conversion |
GL_UNSIGNED_BYTE | 2 8 - 1 | 2 8 - 1 c |
GL_BYTE | 2 7 - 1 | 2 8 - 1 c - 1 2 |
GL_UNSIGNED_SHORT | 2 16 - 1 | 2 16 - 1 c |
GL_SHORT | 2 15 - 1 | 2 16 - 1 c - 1 2 |
GL_UNSIGNED_INT | 2 32 - 1 | 2 32 - 1 c |
GL_INT | 2 31 - 1 | 2 32 - 1 c - 1 2 |
GL_HALF_FLOAT | none | c |
GL_FLOAT | none | c |
GL_UNSIGNED_BYTE_3_3_2 | 2 N - 1 | 2 N - 1 c |
GL_UNSIGNED_BYTE_2_3_3_REV | 2 N - 1 | 2 N - 1 c |
GL_UNSIGNED_SHORT_5_6_5 | 2 N - 1 | 2 N - 1 c |
GL_UNSIGNED_SHORT_5_6_5_REV | 2 N - 1 | 2 N - 1 c |
GL_UNSIGNED_SHORT_4_4_4_4 | 2 N - 1 | 2 N - 1 c |
GL_UNSIGNED_SHORT_4_4_4_4_REV | 2 N - 1 | 2 N - 1 c |
GL_UNSIGNED_SHORT_5_5_5_1 | 2 N - 1 | 2 N - 1 c |
GL_UNSIGNED_SHORT_1_5_5_5_REV | 2 N - 1 | 2 N - 1 c |
GL_UNSIGNED_INT_8_8_8_8 | 2 N - 1 | 2 N - 1 c |
GL_UNSIGNED_INT_8_8_8_8_REV | 2 N - 1 | 2 N - 1 c |
GL_UNSIGNED_INT_10_10_10_2 | 2 N - 1 | 2 N - 1 c |
GL_UNSIGNED_INT_2_10_10_10_REV | 2 N - 1 | 2 N - 1 c |
GL_UNSIGNED_INT_24_8 | 2 N - 1 | 2 N - 1 c |
GL_UNSIGNED_INT_10F_11F_11F_REV | -- | Special |
GL_UNSIGNED_INT_5_9_9_9_REV | -- | Special |
GL_FLOAT_32_UNSIGNED_INT_24_8_REV | none | c (Depth Only) |
NOTES¶
Values for pixels that lie outside the window connected to the current GL context are undefined. If an error is generated, no change is made to the contents of data.ERRORS¶
ASSOCIATED GETS¶
SEE ALSO¶
COPYRIGHT¶
Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.05/30/2012 | [FIXME: source] |