OpenGL Distilled

5.3. Copying Pixels

OpenGL also provides a mechanism to copy pixel data from one framebuffer location to another. The glCopyPixels() command behaves as though your application called glReadPixels() to obtain a pixel rectangle and then called glDrawPixels() to render it back into the framebuffer.

void glCopyPixels( GLint x, GLint y, GLsizei width, GLsizei height,

  GLenum type );

Copies data within the framebuffer. x, y, width, and height have the same meaning as for glReadPixels(). type indicates which portion of the framebuffer to copy and must be GL_COLOR, GL_DEPTH, or GL_STENCIL.

glCopyPixels() copies the width x height pixel rectangle with the bottom-left corner at x and y to the current raster position.

As with glReadPixels(), pixel data is undefined if the source region for the copy isn't owned by OpenGL (for example, part of the region lies outside the window or is obscured by another window).

Категории

© amp.flylib.com,