Sign in to follow this  

More than one FBO causes error

This topic is 1197 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

 

 

 

 

 

Share this post


Link to post
Share on other sites

This topic is 1197 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this