Unable to unbind frameBuffer causing a black screen

I am trying to run a HDR pass using a framebuffer but am facing a weird issue in which I am not able to unbind the HDR buffer. If I render my scene without binding the HDR buffer it works fine. However, Once I bind the frame buffer , then unbind it, then render anything again, nothing shows up but a black screen

glBindFramebuffer(GL_FRAMEBUFFER, HDRBBuffer.fboId);
unsigned int attachments[1] = { GL_COLOR_ATTACHMENT0 };
glDrawBuffers(1, attachments);

glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
sceneRenderer.renderScene(scene); // this is where the geometry renders
glBindFramebuffer(GL_FRAMEBUFFER, 0);

sceneRenderer.renderScene(scene); // this is where the geometry renders

For example the above code renders a black screen. I am pretty sure that the Framebuffer is setup correctly as I can see the scene getting rendered to a texture when I debug my application using Nvidia Nsight. However, if I don’t use the framebuffer at all the code runs just fine.

	/*glBindFramebuffer(GL_FRAMEBUFFER, HDRBBuffer.fboId);
unsigned int attachments[1] = { GL_COLOR_ATTACHMENT0 };
glDrawBuffers(1, attachments);*/

glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//sceneRenderer.renderScene(scene);
//glBindFramebuffer(GL_FRAMEBUFFER, 0);

sceneRenderer.renderScene(scene);

This seems to render just fine except for the lighting which is messed up because of No HDR.

Are you clearing the default framebuffer before rendering to it? If the depth buffer isn’t cleared and depth testing is enabled, it’s possible that all fragments fail the depth test.

The first thing that came to mind to me is, are you sure the default framebuffer (usually the window) was active before your offscreen FBO rendering?

Try commenting out everything except the glBindFramebuffer( GL_FRAMEBUFFER, 0 ). Or, in your second code fragment, just uncomment that line. Do you see your rendering?

@GClemenets that did it. cant believe it was so simple. Thanks for the help.