glFramebufferRenderbuffer Function

Syntax

GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer(
     GLenum target,
     GLenum attachment,
     GLenum renderbuffertarget,
     GLuint renderbuffer
);

Parameters

Name Description
in target Target framebuffer
in attachment Attachment point
in renderbuffertarget Target render buffer
in renderbuffer Render buffer object

Return Values

No values are returned.

Description

Attaches a render buffer to the current framebuffer.

Set target to GL_FRAMEBUFFER.

Set attachment to GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTACHMENT, or GL_DEPTH_STENCIL_ATTACHMENT to attach the render buffer to the color buffer, depth buffer, or depth buffer and stencil buffer, respectively.

Set renderbuffertarget to GL_RENDERBUFFER.

Set renderbuffer to the render buffer object to attach. Set renderbuffer to 0 to detach an object.

From some POD environments, it is not possible to attach a render buffer in the GL_DEPTH24_STENCIL8_EXT format to GL_DEPTH_STENCIL_ATTACHMENT. In a situation like this, you must call this function twice: once with attachment set to GL_DEPTH_ATTACHMENT and once with attachment set to GL_STENCIL_ATTACHMENT. Use glCheckFramebufferStatus to determine whether it was attached successfully.

This function generates the following errors.

GL_INVALID_ENUMThe target, attachment, or renderbuffertarget argument was set to an invalid value.
GL_INVALID_OPERATION0 is bound to the current framebuffer in POD.
GL_INVALID_OPERATIONThe renderbuffer argument specifies an invalid render buffer object.
GL_INVALID_OPERATIONThe attachment argument is GL_COLOR_ATTACHMENT0, but the format of renderbuffer is not GL_RGB8_OES, GL_RGBA8_OES, GL_RGBA4, GL_RGB565, GL_RGB5_A1, or GL_GAS_DMP.
GL_INVALID_OPERATIONThe attachment argument is GL_DEPTH_ATTACHMENT, but the format of renderbuffer is not GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24_OES, or GL_DEPTH24_STENCIL8_EXT.
GL_INVALID_OPERATIONThe attachment argument is GL_STENCIL_ATTACHMENT, but the format of renderbuffer is not GL_DEPTH24_STENCIL8_EXT.

Revision History

2010/01/07
Initial version.

CONFIDENTIAL