Graphics Reference
In-Depth Information
multisample renderbuffer to a texture (with a framebuffer object that has
a texture bound for the color attachment).
You can perform this operation using the following command:
void
glBlitFramebuffer
(GLint
srcX0
, GLint
srcY0
,
GLint
srcX1,
GLint
srcY1
,
GLint
dstX0,
GLint
dstY0
,
GLint
dstX1,
GLint
dstY1
,
GLbitfield
mask,
GLenum
filter
)
srcX0, srcY0, srcX1, srcY1
specify the bound of the source
rectangle within the read buffer
dstX0, dstY0, dstX1, dstY1
specify the bound of the
destination rectangle within the write buffer
specifies the bit-wise or of the flags indicating which
buffers are to be copied; consists of
GL_COLOR_BUFFER_BIT
GL_DEPTH_BUFFER_BIT
GL_STENCIL_BUFFER_BIT
GL_DEPTH_STENCIL_ATTACHMENT
mask
specifies the interpolation to be applied if the image is
stretched; must be
GL_NEAREST
or
GL_LINEAR
filter
Example 12-1 (as part of the
Chapter_11/MRTs
example) illustrates
how to use framebuffer blits to copy four color buffers from a
framebuffer object into four quadrants of the window for the default
framebuffer.
Example 12-1
Copying Pixels Using Framebuffer Blits
void BlitTextures ( ESContext *esContext )
{
UserData *userData = esContext->userData;
// set the default framebuffer for writing
glBindFramebuffer ( GL_DRAW_FRAMEBUFFER,
defaultFramebuffer );
// set the fbo with four color attachments for reading
glBindFramebuffer ( GL_READ_FRAMEBUFFER, userData->fbo );
(continues)