void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
x, y | Specify the window coordinates of the lower left corner of the rectangular region of pixels to be copied. |
width, height | Specify the dimensions of the rectangular region of pixels to be copied. Both must be nonnegative. |
type | Specifies whether color values, depth values, or stencil values are to be copied. Symbolic constants GL_COLOR, GL_DEPTH, and GL_STENCIL are accepted. |
x and y specify the window coordinates of the lower left corner of the rectangular region to be copied. width and height specify the dimensions of the rectangular region to be copied. Both width and height must not be negative.
Several parameters control the processing of the pixel data while it is being copied. These parameters are set with three commands: glPixelTransfer, glPixelMap, and glPixelZoom. This reference page describes the effects on glCopyPixel of most, but not all, of the parameters specified by these three commands.
glCopyPixel copies values from each pixel with lower left
corner at
If GL_INTERLACE_READ_I3D is enabled, every other row is read. The
jth row is read from the window coordinate
type specifies whether color, depth, or stencil data is to be copied. The details of the transfer for each data type are as follows:
If the GL is in RGBA mode, the red, green, blue, and alpha components of each pixel that is read are converted to an internal floating-point format with unspecified precision. The conversion maps the largest representable component value to 1.0, and component value 0 to 0.0. The resulting floating-point color values are then multiplied by GL_c_SCALE and added to GL_c_BIAS, where c is RED, GREEN, BLUE, and ALPHA for the respective color components.
If GL_MAP_COLOR is true, each color component is
clamped to the range
If GL_COLOR_TABLE_EXT is true, each color component is
clamped to the range
If GL_CONVOLUTION_2D_EXT or GL_SEPARABLE_2D_EXT is true, two-dimensional convolution will be performed on each color component according to the format of the convolution filter (see glConvolutionFilter2DEXT and glSeparableFilter2DEXT).
If GL_POST_CONVOLUTION_COLOR_TABLE_EXT is true, each color component is
clamped to the range
Each color is then transformed by the color matrix (see glMatrixMode).
If GL_POST_COLOR_MATRIX_COLOR_TABLE_EXT is true, each color component is
clamped to the range
Each color is then clamped to the color clamp values (see glPixelTransfer).
The GL then converts the resulting indices or RGBA colors to fragments by attaching the current raster position z coordinate and texture coordinates to each pixel.
If GL_PIXEL_TEX_GEN_EXT, the image RGBA color is used as the texture coordinates for the fragment and the image color is replaced according to the pixel texture generation mode (see glPixelTexGenEXT).
Window coordinates x and y are assigned to the nth fragment according to the following equations:
xn = xr + i
yn = yr + j
where (xr, yr) is the current raster position, and the pixel was the ith pixel in the jth row. If GL_INTERLACE_EXT is enabled, the yn window coordinates is calculated as follows:
yn = yr + 2 * j
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.
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 window coordinates (xr + i, yr + j), where (xr, yr) is the current raster position, and the pixel was the ith pixel in the jth row. 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.
and
where zoomx is the value of GL_ZOOM_X and zoomy is the value of GL_ZOOM_Y.
GL_INVALID_VALUE is generated if either width or height is negative.
GL_INVALID_OPERATION is generated if type is GL_DEPTH and there is no depth buffer.
GL_INVALID_OPERATION is generated if type is GL_STENCIL and there is no stencil buffer.
GL_INVALID_OPERATION is generated if glCopyPixels is executed between the execution of glBegin and the corresponding execution of glEnd.