More than one FBO causes error

Started by
-1 comments, last by spriggan 9 years, 7 months ago

Hello,

When I try to create more than one Frame Buffer Object, I get the GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER error.

Here is the code:

//-----------------------------------------------------------------------------------------------------

// Generate frame buffer index
glGenFramebuffers(1, &m_uFramebufferIndex);
// reading and writing to frame buffer
glBindFramebuffer(GL_FRAMEBUFFER, (GLuint)m_uFramebufferIndex);
// create texture for rendering
TextureMan_Get()->CreateTexture(puTexId, uXRes, uYRes);
m_uTexId = *puTexId;
// attach texture to frame buffer
glFramebufferTexture2D(GL_FRAMEBUFFER, (GLenum)uAttachmentIndex,GL_TEXTURE2D, (GLuint)m_uTexId, 0);
if (bDepthBuffer)
{
// The optional depth buffer
glGenRenderbuffers(1, &m_uRenderbufferIndex);
glBindRenderbuffer(GL_RENDERBUFFER, (GLuint)m_uRenderbufferIndex);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, (GLsizei)uXRes, (GLsizei)uYRes);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, (GLuint)m_uRenderbufferIndex);
}
// check frame buffer
uint32 uStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if(uStatus == GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT)
{
assert(0 && "Frame buffer attatchment is incomplete");
}
else if(uStatus == GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT)
{
assert(0 && "Frame buffer missing attachment");
}
else if(uStatus == GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER)
{
assert(0 && "Frame buffer lacks draw buffer");
}
else if(uStatus == GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER)
{
assert(0 && "Frame buffer lacks read buffer");
}
else if(uStatus == GL_FRAMEBUFFER_UNSUPPORTED)
{
assert(0 && "Frame buffer not supported on this system");
}
else if(uStatus == 0)
{
assert(0 && "Frame buffer has unknown error");
}
The code exits the function and updates the draw buffers table below
// Set the list of draw buffers.
glDrawBuffers(m_nNumRenderTargets, m_uColourAttatchments);
// unbind FBO
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
//-----------------------------------------------------------------------------------------------------
Thanks for any help.

This topic is closed to new replies.

Advertisement