Deleting a framebuffer makes my application crash

When I try to delete a framebuffer because it is no longer used the application crashes.

The FB is complete and has been used successfully.
There are no OpenGL errors.
It has one color attachment as RGBA.
DEPTH-only attachments (as for shadow maps) don’t crash
It crashes saying: "unhandled exception in 0x0000000 viewer.exe: 0xC000005.

How can I debug this error? Any ideas=

This could happen for many reasons…a piece of code might help.
Do you return correctly to the default framebuffer, calling for example glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0) and setting the draw buffer to GL_BACK, if it is modified?

Thanks for answering…

I added the code you suggested before framebuffer deletion but it’s still crashing.


	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,0);
	glDrawBuffer(GL_BACK);
	glReadBuffer(GL_BACK);

Any way it was supposed that if you delete the current FB, it automatically returns you to the main FB.

It’s hard to put some pice of code because it’s all scattered over my engine, if you want some piece of code in particular, please ask for it and I’ll post it.

Before deleting, use some sanity check functions for your framebuffer to make sure that it’s ok & fine.

You can also use glIntercept to automatically track possible errors (just in case you use your own glGetError() scattered here & there)

Oh my god! It was a NULL pointer issue! My “glDeleteFramebuffersEXT” function NULL :frowning: What a stupid mistake!

Thank you all for your help!