Hold the horses ... Yes, you can get the draw tied at the moment and read the FBOs with:
GLint drawFboId = 0, readFboId = 0; glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &drawFboId); glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &readFboId);
and for backward compatibility, GL_FRAMEBUFFER_BINDING equivalent to GL_DRAW_FRAMEBUFFER_BINDING :
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &drawFboId);
But for the scenario you are describing, you most likely do not want to use this one . A diagnostic message tells you that you are making an excessive state change. But asking for the current state to compare it to your new value is likely much worse.
glGet*() calls can cause a certain level of synchronization and be quite detrimental to performance. They should usually be avoided in critical parts of your code.
You have two options that are likely to be better than you planned:
- Ignore diagnostic message. The driver is likely to detect a redundant change and in any case avoid unnecessary work. And he can do it much more efficiently than a solution that includes an application that calls
glGet*() calls. - Keep track of the latest related FBOs in your own code so you can filter out redundant changes without using
glGet*() calls.
In any case, what you had in mind would be like the notorious "extinguishing fire with gasoline."
source share