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.