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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - AIR

Pages: [1]
1
Graphics / Framerate inconsistency
« on: September 30, 2016, 03:59:21 am »
I'm using SFML to develop a program for an experiment, which requires extremely precise timing.

I usually write these experimental programs using a graphics toolbox in Matlab. Using this graphics toolbox, the program loops once for every monitor refresh. For example, on a 60Hz monitor, each loop runs for precisely 16.7ms.
Unfortunately, when using SFML, the timing between iterations of the game loop is much more variable; some iterations can take as long as 40ms - even I'm not presenting anything but a blank screen. In this situation, the game loop tends to compensate in that the next iteration is considerably faster. However, in my case, this is more of a hindrance than a help, because the iteration runs through before the next monitor refresh, which essentially means that whatever I was going to display during that frame is missed completely.

I've used "window.setVerticalSyncEnabled(true)" in order to synch the game loop to the monitor refresh rate. I've also found that using fullscreen mode helps a little. Yet the problem persists despite these measures.

Is there anything else I can do to reduce variability in the duration of my gameloop iterations?
One suggestion I've seen is to split updating and drawing into separate threads, would this result in a more consistent framerate?

Someone has also suggested to me that the inconsistency is actually in the clock, rather than the fliptime - the idea being that the timing is being inconsistently reported. I was planning to use the clock to correct for missed frames by basing the display on the elapsed time between flips rather than the number of frames, but this won't work if the reported clocktime is inaccurate...Does anyone know how accurate the clock timing is?

Thanks for the help!

Pages: [1]