SFTtech / openage

Free (as in freedom) open source clone of the Age of Empires II engine 🚀
http://openage.dev
Other
12.68k stars 1.12k forks source link

Dynamically fetch default FBO #1598

Closed heinezen closed 11 months ago

heinezen commented 11 months ago

Changes the default FBO ID from being hardcoded to fetching it every frame for the current context. This is necessary for platforms where the default FBO is not fixed to 0 and changes on a frame-by-frame basis, e.g. when using Wayland.

Fixes https://github.com/SFTtech/openage/issues/1596

heinezen commented 11 months ago

@TheJJ I think this is a side effect of isolation. Looks like the used framebuffer is associated with the window surface and changes to the surface result in new framebuffers being used.

On some platforms (for instance, iOS) the default framebuffer object depends on the surface being rendered to, and might be different from 0. Thus, instead of calling glBindFramebuffer(0), you should call glBindFramebuffer(ctx->defaultFramebufferObject()) if you want your application to work across different Qt platforms.

https://doc.qt.io/qt-6/qopenglcontext.html#defaultFramebufferObject