glReadPixels

Image data can be read back from the frame buffer with glReadPixels

pixels = glReadPixels(x, y, width, height,
                      format, type)

x , y - lower left corner of image
width , height - size of image, in pixels
format - GL_RGB or GL_LUMINANCE (or other values)
type - GL_UNSIGNED_BYTE for 8-bit-per-channel images
pixels - returned array of image data


Note: in C, pixels is the last argument of the function, rather than the return value.

next