Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Strange graphics behaviour at very low frame rates  (Read 1177 times)

0 Members and 1 Guest are viewing this topic.

GaborKovacs

  • Newbie
  • *
  • Posts: 13
    • View Profile
Strange graphics behaviour at very low frame rates
« on: October 18, 2011, 10:50:17 am »
Hi! I'm using SMFL (both 1.6 and 2.0, the latter through its .NET binding) to create software for psychology experiments, so the general architecture of my apps is typically different from that of a game. Most importantly, since there is no need for animation, I do not redraw the screen (render window) for each and every frame.

In terms of pseudocode, the main loop normally looks like this:

Code: [Select]
while (running)
{
    ClearScreenAndDrawElements();
    DisplayScreen();
    WaitForUserInputOrTimeOut(); // this can take several seconds
}


99% of the time everything goes fine, but sometimes, quite unpredictably, the frame displayed does not appear the way it should. This happens most often in the first couple of frames, right after creating the SFML RenderWin. As I said in another post, sometimes the OS system tray appears on top of a full screen RenderWin, at other times, only some of the elements appear on a black background, and at yet other times, missing elements appear on the next frame as if the drawing operation could not finish and were deferred.

Obviously, these issues normally go unnoticed if you write a game and redraw your screen at 30 FPS.

I've been wondering if the Draw and Display methods run on different threads, and these phenomena could be due to some subtle synchronization issue...

Or, maybe what I do is simply not the way SFML is meant to be used?

Thanks for your help in advance.

Gabor

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Strange graphics behaviour at very low frame rates
« Reply #1 on: October 18, 2011, 11:20:55 am »
Quote
I've been wondering if the Draw and Display methods run on different threads, and these phenomena could be due to some subtle synchronization issue...

Nop.

Quote
Or, maybe what I do is simply not the way SFML is meant to be used?

Indeed, SFML is not meant to be used like this. However, the way you did it should work.
Laurent Gomila - SFML developer

GaborKovacs

  • Newbie
  • *
  • Posts: 13
    • View Profile
Strange graphics behaviour at very low frame rates
« Reply #2 on: October 19, 2011, 08:58:33 pm »
Thanks. So it cannot be a multithreading issue, then...

I suppose I'll do a little bit of testing (on other machines as well) to see under what circumstances these problems tend to occur. I'll tell you if I find something.

Best regards,
Gabor

 

anything