soulweaver91 / project-carrot

Project Carrot, an open source spiritual clone of the Jazz Jackrabbit 2 game engine
https://carrot.soulweaver.fi/
MIT License
38 stars 4 forks source link

The view may render upside down while resizing the window #31

Closed soulweaver91 closed 8 years ago

soulweaver91 commented 8 years ago

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.

soulweaver91 commented 8 years ago

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