Open BerntA opened 2 years ago
Not sure if this helps, but in the msc source archive there's a copy of this article which leads me to think that MSC's glow code is based off that article?
Damn, it seems very likely
From the little information I could gather with API traces, it appears as if the back buffer at the time of rendering the effect is a copy of the UI of the last frame. The front buffer however contains the game scene in its entirety, so it should be easy to fix. Most likely this is a driver difference between window and fullscreen buffer flipping, where in fullscreen it is set to Swap
, but in window it is set to Copy
.
Correction to the above. In windowed mode, GL_BACK_LEFT contains the game scene minus the HUD. In fullscreen mode, GL_BACK_LEFT appears to not exist, so it is considered GL_NONE. My new code at least does not blind people, so that's a plus.
I've got a few better API validation tools working. While windowed works because of it using GL_FRONT and GL_BACK as expected, fullscreen breaks due to the engine suddenly switching glDrawBuffer
to GL_COLOR_ATTACHMENT0
. This results in the following errors when attempting to read from it:
glGetError(glReadBuffer) = GL_INVALID_OPERATION
warning: message: high error 1280: GL_INVALID_ENUM error generated.
warning: message: high error 1286: GL_INVALID_FRAMEBUFFER_OPERATION error generated. Framebuffer bindings are not framebuffer complete.
warning: message: low issue 131169: Framebuffer detailed info: The driver allocated storage for renderbuffer 4.
warning: message: high error 1286: GL_INVALID_FRAMEBUFFER_OPERATION error generated. Framebuffer bindings are not framebuffer complete.
warning: incomplete GL_READ_FRAMEBUFFER (GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT)
Due to the older docs for OpenGL slowly disappearing, figuring out what this actually means was difficult, but not impossible. The TL;DR is that the FBO does not have any initialized texture assigned to GL_READ_FRAMEBUFFER, so it can't be used for such operations - and the textures stay black.
At least I know what's going on now - didn't even have a correct guess at what was going on before.
We should fix bloom in full screen mode, perhaps we also have to update some of the related libraries that are used for this functionality.. / otherwise try to also cleanup the currently used libs, I do not think we need all of them.