4
« on: April 15, 2020, 11:03:02 pm »
Hello everyone.
Sorry if failed to find a solution in the topics, I did try the search.
For the past 3 days I've been trying to find a reason for an issue I've been facing when running project in fullscreen mode.
I've tried to make a video and a screenshot, but for whatever reason that does not capture the artifacts, so I will try to explain that + add a screenshot with a small drawing.
Using .net SFML
I reduced everything in the project to have a sprite and a view for movement.
View is getting updated every frame and under certain conditions I move the view to have the effect of scrolling the world.
Whenever I set the fullscreen style:
_window = new RenderWindow(VideoMode.DesktopMode, "", Styles.Fullscreen);
I get strange behavior as if I see the previos frame buffer (kinda tried to draw that on screenshot)
What bothers me is that happens ONLY in fullscreen and I can not understand the reason behind that.
So I try to limit the framerate like this - update and render ~60 times a second:
private float _timePerFrame = 1.0f / 60.0f;
......................
while(_window.IsOpen)
{
_timeSinceLastUpdate += clock.Restart().AsSeconds();
if (_timeSinceLastUpdate > _timePerFrame)
{
_timeSinceLastUpdate -= _timePerFrame;
_window.DispatchEvents();
Update(_timePerFrame);
Render();
}
}
Now setting VSync makes the problem dissapear, but I would still like to understand why this happens.
My monitors refresh rate is 60 (well 59 by looking into display settings).
Any ideas are very appreciated.