soulweaver91/project-carrot

The view may render upside down while resizing the window

Closed this issue · 1 comments

This mostly happens when changing the window size very slowly. This has to do with the nature of the sf::RenderTextures, which are essentially frame buffer objects. In OpenGL context, the Y axis is flipped for FBOs, which is taken into account with SFML's display(). During the resize, there seems to be some kind of race condition that causes the wrong (non-displayed) buffer of the view to be drawn – of note is that the player OSD is always correctly drawn.

Attempts to add additional clear() (for a black render) or display() (for correct orientation image), as well as using a mutex to restrict drawing order, did not succeed.

If I saw correctly, this can happen on the first frame right after the level has loaded, too.