next up previous contents index
Next: 4.3.4 Pixel draw/read state Up: 4.3 DrawingReading, and Previous: Placement in Client

4.3.3 Copying Pixels

 

CopyPixels  transfers a rectangle of pixel values from one region of the framebuffer to another. Pixel copying is diagrammed in Figure 4.3.

  
Figure 4.3: Operation of CopyPixels . RGBA and color index pixel paths are shown; depth and stencil pixel paths are not shown. RGBA-to-RGBA and index-to-index lookup are optional. Index-to-RGBA lookup is currently never performed.

void CopyPixels ( int x, int y, sizei width, sizei height, enum type ) ;

type is a symbolic constant that must be one of COLOR, STENCIL, or DEPTH, indicating that the values to be transferred are colors, stencil values, or depth values, respectively. The first four arguments have the same interpretation as the corresponding arguments to ReadPixels .

Values are obtained from the framebuffer, converted (if appropriate), then subjected to the pixel transfer operations (see section 3.6.4), just as if ReadPixels  were called with the corresponding arguments. If the type is STENCIL or DEPTH, then it is as if the format for ReadPixels  were STENCIL_INDEX or DEPTH_COMPONENT, respectively. If the type is COLOR, then if the GL is in RGBA mode, it is as if the format were RGBA, while if the GL is in color index mode, it is as if the format were COLOR_INDEX.

The groups of elements so obtained are then written to the framebuffer just as if DrawPixels  had been given width and height, beginning with final conversion of elements. The effective format is the same as that already described.



David Blythe
Sat Mar 29 02:23:21 PST 1997