| void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); |
| Reads pixel data from the framebuffer rectangle whose lower-left corner is at (x, y) and whose dimensions are width and height and stores it in the array pointed to by pixels. format indicates the kind of pixel data elements that are read (an index value or an R, G, B, or A component value, as listed in Table below), and type indicates the data type of each element shown below. |
| void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); |
| Draws a rectangle of pixel data with dimensions width and height. The pixel rectangle is drawn with its lower-left corner at the current raster position. format and type have the same meaning as with glReadPixels(). The array pointed to by pixels contains the pixel data to be drawn. |
| void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum buffer); |
|
Copies pixel data from the framebuffer rectangle whose lower-left corner is
at (x, y) and whose dimensions are width and height. The data is copied to a
new position whose lower-left corner is given by the current raster position.
buffer is either GL_COLOR, GL_STENCIL, or GL_DEPTH, specifying the
framebuffer that is used. glCopyPixels() behaves similarly to a
glReadPixels() followed by a glDrawPixels(), with the following translation
for the buffer to format parameter:
|
JOGL: for JOGL the GLvoid * pixels Pointer becomes a type Buffer.
format Constant | Pixel Format |
|---|---|
GL_COLOR_INDEX | A single color index |
GL_RGB | A red color component, followed by a green color component, followed by a blue color component |
GL_RGBA | A red color component, followed by a green color component, followed by a blue color component, followed by an alpha color component |
GL_RED | A single red color component |
GL_GREEN | A single green color component |
GL_BLUE | A single blue color component |
GL_ALPHA | A single alpha color component |
GL_LUMINANCE | |
GL_LUMINANCE_ALPHA | A luminance component followed by an alpha color component |
GL_STENCIL_INDEX | A single stencil index |
GL_DEPTH_COMPONENT | A single depth component |
Data Types for glReadPixels() or glDrawPixels():
type Constant | Data Type |
|---|---|
GL_UNSIGNED_BYTE | unsigned 8-bit integer |
GL_BYTE | signed 8-bit integer |
GL_BITMAP | single bits in unsigned 8-bit integers using the same format as glBitmap() |
GL_UNSIGNED_SHORT | unsigned 16-bit integer |
GL_SHORT | signed 16-bit integer |
GL_UNSIGNED_INT | unsigned 32-bit integer |
GL_INT | signed 32-bit integer |
GL_FLOAT | single-precision floating point |