Sign in to follow this  

Problem setting up framebuffer

This topic is 4107 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

Hi, I'm trying to implement framebuffers. I want to draw a picture into my framebuffer, copy it to a texture and use it as an inmput for my fragmentshader. However, when setting up my framebuffer I get the Errormessage : "Error missing attachment". My code looks like this: ... glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB,currentSizeX, currentSizeY, 0, GL_RGBA, GL_FLOAT, NULL); glGenFramebuffersEXT(1, &framebuf[i]); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuf[i]); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, depthMap[i], 0); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); if(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)==GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT) { std::cout << "Error missing attatchment" << std::endl; } ... Does anybody see an error or is anything missing? Any help on this is appreciated, Thx, Icebraker

Share this post


Link to post
Share on other sites
Just to make things clear: framebuffer objects (FBOs) doesn't copy from the framebuffer but rather render directly to a provided texture (to copy the framebuffer use glCopyTexSubImage2D, but you probably don't wanna do that).

I can't really see anything wrong in your fbo-code except that you shouldn't create the texture and fbo each frame. This should be done once, then in the render-function, just do:

glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, id);
//[render something]
glDrawBuffer(oldDrawBuffer); //reset draw buffer to screen
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);


btw, I guess you have cut off the rest of your texture-creating code? Either way I paste my code for creating a floating point texture. Remember you must set the filtering to nearest neighbor:

glActiveTexture(m_texUnit);
glGenTextures(1, &m_textID);
glBindTexture(target, m_textID);
glEnable(target);

glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB,currentSizeX, currentSizeY, 0, GL_RGBA, GL_FLOAT, NULL);


Hope that helps!

Share this post


Link to post
Share on other sites

This topic is 4107 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