I am struggling with implementing a proper Framebuffer Object .
glCheckFramebufferStatus is returning me: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT (36054).
What am i missing?
GLuint fbo, rboColor, rboDepth;
// Color renderbuffer.
glGenRenderbuffers(1,&rboColor);
glBindRenderbuffer(GL_RENDERBUFFER,rboColor);
// Set storage for currently bound renderbuffer.
glRenderbufferStorage(GL_RENDERBUFFER, GL_BGRA, _w, _h);
// Depth renderbuffer
glGenRenderbuffers(1,&rboDepth);
glBindRenderbuffer(GL_RENDERBUFFER,rboDepth);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, _w, _h);
// Framebuffer
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER,fbo);
glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rboColor);
// Set renderbuffers for currently bound framebuffer
glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,GL_RENDERBUFFER,rboDepth);
// Set to write to the framebuffer.
glBindFramebuffer(GL_FRAMEBUFFER,fbo);
// Tell glReadPixels where to read from.
glReadBuffer(GL_COLOR_ATTACHMENT0);
GLenum e = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);//glCheckFramebufferStatus: check the completeness status of a framebuffer
if (e != GL_FRAMEBUFFER_COMPLETE) {
printf("\nThere is a problem with the FBO.");
}