GLAPI/glReadPixels: Difference between revisions

From OpenGL Wiki
Jump to navigation Jump to search
m Renaming category: 'API Reference 4' to 'Core API Reference'.
m Bot: Adding better formatting.
Line 8: Line 8:
== Function Definition ==
== Function Definition ==


   void '''glReadPixels'''(GLint ''x'', GLint ''y'', GLsizei ''width'', GLsizei ''height'', GLenum ''format'', GLenum ''type'', GLvoid * ''data'');
   void '''glReadPixels'''(GLint {{param|x}}, GLint {{param|y}}, GLsizei {{param|width}}, GLsizei {{param|height}}, GLenum {{param|format}}, GLenum {{param|type}}, GLvoid * {{param|data}});


; x, y
; x, y
: Specify 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.
: Specify 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
; width, height
: Specify the dimensions of the pixel rectangle. ''width'' and ''height'' of one correspond to a single pixel.
: Specify the dimensions of the pixel rectangle. {{param|width}} and {{param|height}} of one correspond to a single pixel.
; format
; format
: Specifies the format of the pixel data. The following symbolic values are accepted: {{code|GL_STENCIL_INDEX}}, {{code|GL_DEPTH_COMPONENT}}, {{code|GL_DEPTH_STENCIL}}, {{code|GL_RED}}, {{code|GL_GREEN}}, {{code|GL_BLUE}}, {{code|GL_RGB}}, {{code|GL_BGR}}, {{code|GL_RGBA}}, and {{code|GL_BGRA}}.
: Specifies the format of the pixel data. The following symbolic values are accepted: {{code|GL_STENCIL_INDEX}}, {{code|GL_DEPTH_COMPONENT}}, {{code|GL_DEPTH_STENCIL}}, {{code|GL_RED}}, {{code|GL_GREEN}}, {{code|GL_BLUE}}, {{code|GL_RGB}}, {{code|GL_BGR}}, {{code|GL_RGBA}}, and {{code|GL_BGRA}}.
Line 23: Line 23:
== Description ==
== Description ==


'''glReadPixels''' returns pixel data from the frame buffer, starting with the pixel whose lower left corner is at location (''x'', ''y''), into client memory starting at location ''data''. Several parameters control the processing of the pixel data before it is placed into client memory. These parameters are set with [[GLAPI/glPixelStore|glPixelStore]]. This reference page describes the effects on '''glReadPixels''' of most, but not all of the parameters specified by these three commands.
'''glReadPixels''' returns pixel data from the frame buffer, starting with the pixel whose lower left corner is at location ({{param|x}}, {{param|y}}), into client memory starting at location {{param|data}}. Several parameters control the processing of the pixel data before it is placed into client memory. These parameters are set with {{apifunc|glPixelStore}}. This reference page describes the effects on '''glReadPixels''' of most, but not all of the parameters specified by these three commands.


If a non-zero named buffer object is bound to the {{code|GL_PIXEL_PACK_BUFFER}} target (see [[GLAPI/glBindBuffer|glBindBuffer]]) while a block of pixels is requested, ''data'' is treated as a byte offset into the buffer object's data store rather than a pointer to client memory.
If a non-zero named buffer object is bound to the {{code|GL_PIXEL_PACK_BUFFER}} target (see {{apifunc|glBindBuffer}}) while a block of pixels is requested, {{param|data}} is treated as a byte offset into the buffer object's data store rather than a pointer to client memory.


'''glReadPixels''' returns values from each pixel with lower left corner at (''x'' + ''i'', ''y'' + ''j'') for 0 &le; ''i'' < ''width'' and 0 &le; ''j'' < ''height''. This pixel is said to be the ''i''th pixel in the ''j''th row. Pixels are returned in row order from the lowest to the highest row, left to right in each row.
'''glReadPixels''' returns values from each pixel with lower left corner at (''x'' + ''i'', ''y'' + ''j'') for 0 &le; ''i'' < ''width'' and 0 &le; ''j'' < ''height''. This pixel is said to be the ''i''th pixel in the ''j''th row. Pixels are returned in row order from the lowest to the highest row, left to right in each row.


''format'' specifies the format for the returned pixel values; accepted values are:
{{param|format}} specifies the format for the returned pixel values; accepted values are:


; {{code|GL_STENCIL_INDEX}}
; {{code|GL_STENCIL_INDEX}}
Line 36: Line 36:
: 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 {{code|GL_DEPTH_SCALE}}, added to {{code|GL_DEPTH_BIAS}}, and finally clamped to the range [0, 1].
: 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 {{code|GL_DEPTH_SCALE}}, added to {{code|GL_DEPTH_BIAS}}, and finally clamped to the range [0, 1].
; {{code|GL_DEPTH_STENCIL}}
; {{code|GL_DEPTH_STENCIL}}
: Values are taken from both the depth and stencil buffers. The ''type'' parameter must be {{code|GL_UNSIGNED_INT_24_8}} or {{code|GL_FLOAT_32_UNSIGNED_INT_24_8_REV}}.
: Values are taken from both the depth and stencil buffers. The {{param|type}} parameter must be {{code|GL_UNSIGNED_INT_24_8}} or {{code|GL_FLOAT_32_UNSIGNED_INT_24_8_REV}}.
; {{code|GL_RED}}
; {{code|GL_RED}}
; {{code|GL_GREEN}}
; {{code|GL_GREEN}}
Line 44: Line 44:
; {{code|GL_RGBA}}
; {{code|GL_RGBA}}
; {{code|GL_BGRA}}
; {{code|GL_BGRA}}
: Finally, the indices or components are converted to the proper format, as specified by ''type''. If ''format'' is {{code|GL_STENCIL_INDEX}} and ''type'' is not {{code|GL_FLOAT}}, each index is masked with the mask value given in the following table. If ''type'' is {{code|GL_FLOAT}}, then each integer index is converted to single-precision floating-point format.
: Finally, the indices or components are converted to the proper format, as specified by {{param|type}}. If {{param|format}} is {{code|GL_STENCIL_INDEX}} and {{param|type}} is not {{code|GL_FLOAT}}, each index is masked with the mask value given in the following table. If {{param|type}} is {{code|GL_FLOAT}}, then each integer index is converted to single-precision floating-point format.


If ''format'' is {{code|GL_RED}}, {{code|GL_GREEN}}, {{code|GL_BLUE}}, {{code|GL_RGB}}, {{code|GL_BGR}}, {{code|GL_RGBA}}, or {{code|GL_BGRA}} and ''type'' is not {{code|GL_FLOAT}}, each component is multiplied by the multiplier shown in the following table. If type is {{code|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).
If {{param|format}} is {{code|GL_RED}}, {{code|GL_GREEN}}, {{code|GL_BLUE}}, {{code|GL_RGB}}, {{code|GL_BGR}}, {{code|GL_RGBA}}, or {{code|GL_BGRA}} and {{param|type}} is not {{code|GL_FLOAT}}, each component is multiplied by the multiplier shown in the following table. If type is {{code|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).


{| class="wikitable"
{| class="wikitable"
|+
|+
! ''type''
! {{param|type}}
! '''Index Mask'''
! '''Index Mask'''
! '''Component Conversion'''
! '''Component Conversion'''
Line 151: Line 151:
|}
|}


Return values are placed in memory as follows. If ''format'' is {{code|GL_STENCIL_INDEX}}, {{code|GL_DEPTH_COMPONENT}}, {{code|GL_RED}}, {{code|GL_GREEN}}, or {{code|GL_BLUE}}, a single value is returned and the data for the ''i''th pixel in the ''j''th row is placed in location ''j'' * ''width'' + ''i''. {{code|GL_RGB}} and {{code|GL_BGR}} return three values, {{code|GL_RGBA}} and {{code|GL_BGRA}} return four values for each pixel, with all values corresponding to a single pixel occupying contiguous space in ''data''. Storage parameters set by [[GLAPI/glPixelStore|glPixelStore]], such as {{code|GL_PACK_LSB_FIRST}} and {{code|GL_PACK_SWAP_BYTES}}, affect the way that data is written into memory. See [[GLAPI/glPixelStore|glPixelStore]] for a description.
Return values are placed in memory as follows. If {{param|format}} is {{code|GL_STENCIL_INDEX}}, {{code|GL_DEPTH_COMPONENT}}, {{code|GL_RED}}, {{code|GL_GREEN}}, or {{code|GL_BLUE}}, a single value is returned and the data for the ''i''th pixel in the ''j''th row is placed in location ''j'' * ''width'' + ''i''. {{code|GL_RGB}} and {{code|GL_BGR}} return three values, {{code|GL_RGBA}} and {{code|GL_BGRA}} return four values for each pixel, with all values corresponding to a single pixel occupying contiguous space in {{param|data}}. Storage parameters set by {{apifunc|glPixelStore}}, such as {{code|GL_PACK_LSB_FIRST}} and {{code|GL_PACK_SWAP_BYTES}}, affect the way that data is written into memory. See {{apifunc|glPixelStore}} for a description.


== Notes ==
== Notes ==
Line 157: Line 157:
Values for pixels that lie outside the window connected to the current GL context are undefined.
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''.
If an error is generated, no change is made to the contents of {{param|data}}.


== Errors ==
== Errors ==


{{code|GL_INVALID_ENUM}} is generated if ''format'' or ''type'' is not an accepted value.
{{code|GL_INVALID_ENUM}} is generated if {{param|format}} or {{param|type}} is not an accepted value.


{{code|GL_INVALID_VALUE}} is generated if either ''width'' or ''height'' is negative.
{{code|GL_INVALID_VALUE}} is generated if either {{param|width}} or {{param|height}} is negative.


{{code|GL_INVALID_OPERATION}} is generated if ''format'' is {{code|GL_STENCIL_INDEX}} and there is no stencil buffer.
{{code|GL_INVALID_OPERATION}} is generated if {{param|format}} is {{code|GL_STENCIL_INDEX}} and there is no stencil buffer.


{{code|GL_INVALID_OPERATION}} is generated if ''format'' is {{code|GL_DEPTH_COMPONENT}} and there is no depth buffer.
{{code|GL_INVALID_OPERATION}} is generated if {{param|format}} is {{code|GL_DEPTH_COMPONENT}} and there is no depth buffer.


{{code|GL_INVALID_OPERATION}} is generated if ''format'' is {{code|GL_DEPTH_STENCIL}} and there is no depth buffer or if there is no stencil buffer.
{{code|GL_INVALID_OPERATION}} is generated if {{param|format}} is {{code|GL_DEPTH_STENCIL}} and there is no depth buffer or if there is no stencil buffer.


{{code|GL_INVALID_ENUM}} is generated if ''format'' is {{code|GL_DEPTH_STENCIL}} and ''type'' is not {{code|GL_UNSIGNED_INT_24_8}} or {{code|GL_FLOAT_32_UNSIGNED_INT_24_8_REV}}.
{{code|GL_INVALID_ENUM}} is generated if {{param|format}} is {{code|GL_DEPTH_STENCIL}} and {{param|type}} is not {{code|GL_UNSIGNED_INT_24_8}} or {{code|GL_FLOAT_32_UNSIGNED_INT_24_8_REV}}.


{{code|GL_INVALID_OPERATION}} is generated if ''type'' is one of {{code|GL_UNSIGNED_BYTE_3_3_2}}, {{code|GL_UNSIGNED_BYTE_2_3_3_REV}}, {{code|GL_UNSIGNED_SHORT_5_6_5}}, or {{code|GL_UNSIGNED_SHORT_5_6_5_REV}} and ''format'' is not {{code|GL_RGB}}.
{{code|GL_INVALID_OPERATION}} is generated if {{param|type}} is one of {{code|GL_UNSIGNED_BYTE_3_3_2}}, {{code|GL_UNSIGNED_BYTE_2_3_3_REV}}, {{code|GL_UNSIGNED_SHORT_5_6_5}}, or {{code|GL_UNSIGNED_SHORT_5_6_5_REV}} and {{param|format}} is not {{code|GL_RGB}}.


{{code|GL_INVALID_OPERATION}} is generated if ''type'' is one of {{code|GL_UNSIGNED_SHORT_4_4_4_4}}, {{code|GL_UNSIGNED_SHORT_4_4_4_4_REV}}, {{code|GL_UNSIGNED_SHORT_5_5_5_1}}, {{code|GL_UNSIGNED_SHORT_1_5_5_5_REV}}, {{code|GL_UNSIGNED_INT_8_8_8_8}}, {{code|GL_UNSIGNED_INT_8_8_8_8_REV}}, {{code|GL_UNSIGNED_INT_10_10_10_2}}, or {{code|GL_UNSIGNED_INT_2_10_10_10_REV}} and ''format'' is neither {{code|GL_RGBA}} nor {{code|GL_BGRA}}.
{{code|GL_INVALID_OPERATION}} is generated if {{param|type}} is one of {{code|GL_UNSIGNED_SHORT_4_4_4_4}}, {{code|GL_UNSIGNED_SHORT_4_4_4_4_REV}}, {{code|GL_UNSIGNED_SHORT_5_5_5_1}}, {{code|GL_UNSIGNED_SHORT_1_5_5_5_REV}}, {{code|GL_UNSIGNED_INT_8_8_8_8}}, {{code|GL_UNSIGNED_INT_8_8_8_8_REV}}, {{code|GL_UNSIGNED_INT_10_10_10_2}}, or {{code|GL_UNSIGNED_INT_2_10_10_10_REV}} and {{param|format}} is neither {{code|GL_RGBA}} nor {{code|GL_BGRA}}.


{{code|GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to the {{code|GL_PIXEL_PACK_BUFFER}} target and the buffer object's data store is currently mapped.
{{code|GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to the {{code|GL_PIXEL_PACK_BUFFER}} target and the buffer object's data store is currently mapped.
Line 181: Line 181:
{{code|GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to the {{code|GL_PIXEL_PACK_BUFFER}} target and the data would be packed to the buffer object such that the memory writes required would exceed the data store size.
{{code|GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to the {{code|GL_PIXEL_PACK_BUFFER}} target and the data would be packed to the buffer object such that the memory writes required would exceed the data store size.


{{code|GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to the {{code|GL_PIXEL_PACK_BUFFER}} target and ''data'' is not evenly divisible into the number of bytes needed to store in memory a datum indicated by ''type''.
{{code|GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to the {{code|GL_PIXEL_PACK_BUFFER}} target and {{param|data}} is not evenly divisible into the number of bytes needed to store in memory a datum indicated by {{param|type}}.


{{code|GL_INVALID_OPERATION}} is generated if {{code|GL_READ_FRAMEBUFFER_BINDING}} is non-zero, the read framebuffer is complete, and the value of {{code|GL_SAMPLE_BUFFERS}} for the read framebuffer is greater than zero.
{{code|GL_INVALID_OPERATION}} is generated if {{code|GL_READ_FRAMEBUFFER_BINDING}} is non-zero, the read framebuffer is complete, and the value of {{code|GL_SAMPLE_BUFFERS}} for the read framebuffer is greater than zero.
Line 187: Line 187:
== Associated Gets ==
== Associated Gets ==


[[GLAPI/glGet|glGet]] with argument {{code|GL_INDEX_MODE}}
{{apifunc|glGet}} with argument {{code|GL_INDEX_MODE}}


[[GLAPI/glGet|glGet]] with argument {{code|GL_PIXEL_PACK_BUFFER_BINDING}}
{{apifunc|glGet}} with argument {{code|GL_PIXEL_PACK_BUFFER_BINDING}}


== See Also ==
== See Also ==


[[GLAPI/glPixelStore|glPixelStore]], [[GLAPI/glReadBuffer|glReadBuffer]]
{{apifunc|glPixelStore}}, {{apifunc|glReadBuffer}}


[[Pixel Transfer]], [[Pixel Buffer Object]]
[[Pixel Transfer]], [[Pixel Buffer Object]]

Revision as of 01:24, 29 April 2012

glReadPixels
Core in version 4.6
Core since version 1.0

glReadPixels: read a block of pixels from the frame buffer

Function Definition

 void glReadPixels(GLint x​, GLint y​, GLsizei width​, GLsizei height​, GLenum format​, GLenum type​, GLvoid * data​);
x, y
Specify 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

glReadPixels returns pixel data from the frame buffer, starting with the pixel whose lower left corner is at location (x​, y​), into client memory starting at location data​. Several parameters control the processing of the pixel data before it is placed into client memory. These parameters are set with glPixelStore. This reference page describes the effects on glReadPixels of most, but not all of the parameters specified by these three commands.

If a non-zero named buffer object is bound to the GL_PIXEL_PACK_BUFFER target (see glBindBuffer) while a block of pixels is requested, data​ is treated as a byte offset into the buffer object's data store rather than a pointer to client memory.

glReadPixels returns values from each pixel with lower left corner at (x + i, y + j) for 0 ≤ i < width and 0 ≤ j < height. This pixel is said to be the ith pixel in the jth row. Pixels are returned in row order from the lowest to the highest row, left to right in each row.

format​ specifies the format for the returned pixel values; accepted values are:

GL_STENCIL_INDEX
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 28 - 1 $ (2^{8}-1)c $
GL_BYTE 27 - 1 $ {\tfrac {(2^{8}-1)c-1}{2}} $
GL_UNSIGNED_SHORT 216 - 1 $ (2^{16}-1)c $
GL_SHORT 215 - 1 $ {\tfrac {(2^{16}-1)c-1}{2}} $
GL_UNSIGNED_INT 232 - 1 $ (2^{32}-1)c $
GL_INT 231 - 1 $ {\tfrac {(2^{32}-1)c-1}{2}} $
GL_HALF_FLOAT none c
GL_FLOAT none c
GL_UNSIGNED_BYTE_3_3_2 2N - 1 $ (2^{N}-1)c $
GL_UNSIGNED_BYTE_2_3_3_REV 2N - 1 $ (2^{N}-1)c $
GL_UNSIGNED_SHORT_5_6_5 2N - 1 $ (2^{N}-1)c $
GL_UNSIGNED_SHORT_5_6_5_REV 2N - 1 $ (2^{N}-1)c $
GL_UNSIGNED_SHORT_4_4_4_4 2N - 1 $ (2^{N}-1)c $
GL_UNSIGNED_SHORT_4_4_4_4_REV 2N - 1 $ (2^{N}-1)c $
GL_UNSIGNED_SHORT_5_5_5_1 2N - 1 $ (2^{N}-1)c $
GL_UNSIGNED_SHORT_1_5_5_5_REV 2N - 1 $ (2^{N}-1)c $
GL_UNSIGNED_INT_8_8_8_8 2N - 1 $ (2^{N}-1)c $
GL_UNSIGNED_INT_8_8_8_8_REV 2N - 1 $ (2^{N}-1)c $
GL_UNSIGNED_INT_10_10_10_2 2N - 1 $ (2^{N}-1)c $
GL_UNSIGNED_INT_2_10_10_10_REV 2N - 1 $ (2^{N}-1)c $
GL_UNSIGNED_INT_24_8 2N - 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)

Return values are placed in memory as follows. If format​ is GL_STENCIL_INDEX, GL_DEPTH_COMPONENT, GL_RED, GL_GREEN, or GL_BLUE, a single value is returned and the data for the ith pixel in the jth row is placed in location j * width + i. GL_RGB and GL_BGR return three values, GL_RGBA and GL_BGRA return four values for each pixel, with all values corresponding to a single pixel occupying contiguous space in data​. Storage parameters set by glPixelStore, such as GL_PACK_LSB_FIRST and GL_PACK_SWAP_BYTES, affect the way that data is written into memory. See glPixelStore for a description.

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

GL_INVALID_ENUM is generated if format​ or type​ is not an accepted value.

GL_INVALID_VALUE is generated if either width​ or height​ is negative.

GL_INVALID_OPERATION is generated if format​ is GL_STENCIL_INDEX and there is no stencil buffer.

GL_INVALID_OPERATION is generated if format​ is GL_DEPTH_COMPONENT and there is no depth buffer.

GL_INVALID_OPERATION is generated if format​ is GL_DEPTH_STENCIL and there is no depth buffer or if there is no stencil buffer.

GL_INVALID_ENUM is generated if format​ is GL_DEPTH_STENCIL and type​ is not GL_UNSIGNED_INT_24_8 or GL_FLOAT_32_UNSIGNED_INT_24_8_REV.

GL_INVALID_OPERATION is generated if type​ is one of GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, GL_UNSIGNED_SHORT_5_6_5, or GL_UNSIGNED_SHORT_5_6_5_REV and format​ is not GL_RGB.

GL_INVALID_OPERATION is generated if type​ is one of 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, or GL_UNSIGNED_INT_2_10_10_10_REV and format​ is neither GL_RGBA nor GL_BGRA.

GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_PACK_BUFFER target and the buffer object's data store is currently mapped.

GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_PACK_BUFFER target and the data would be packed to the buffer object such that the memory writes required would exceed the data store size.

GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to the GL_PIXEL_PACK_BUFFER target and data​ is not evenly divisible into the number of bytes needed to store in memory a datum indicated by type​.

GL_INVALID_OPERATION is generated if GL_READ_FRAMEBUFFER_BINDING is non-zero, the read framebuffer is complete, and the value of GL_SAMPLE_BUFFERS for the read framebuffer is greater than zero.

Associated Gets

glGet with argument GL_INDEX_MODE

glGet with argument GL_PIXEL_PACK_BUFFER_BINDING

See Also

glPixelStore, glReadBuffer

Pixel Transfer, Pixel Buffer Object

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/.