glBindFramebuffer with a valid framebuffer gives GL_INVALID_OPERATION

I try to bind a framebuffer, and it fails. Here’s the code:

errorCode = glGetError(); // returns GL_NO_ERROR
ASSERT(glIsFramebuffer(framebuffer)); // glIsFramebuffer returns true
glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer);
errorCode = glGetError(); // returns GL_INVALID_OPERATION

According to the specification, glBindFrambuffer should only throw GL_INVALID_OPERATION if the framebuffer name is invalid, but then glIsFramebuffer should also return false.

I’m stuck. What other reason could there be?

Another detail: the code above usually works. This error only occurs right after I delete some shader programs and create new ones. But the framebuffers don’t change at all, and in the next frame everything works perfectly again. I also get the same error if I use glBlitNamedFramebuffer without binding.

Also, it’s Windows 10, GTX 1080, driver 388.31.

Hi korteur,

Thanks for your report. I did a quick try but cannot reproduce the error.

As you mentioned the error was only observed in a certain condition. If you could put together a minimized sample program that can reproduce the problem reliably, it will help us root cause the issue.