cinder/Cinder — comment on commit 6352526d12e67156c9b78c7b86a52bd6a8e4c08c
File:  line 0
By paulhoux:

Hi Andrew,

on the forums you mentioned the frame rate going down periodically. I have been thinking about it a bit more and have come to the conclusion that my way of limiting the frame rate is not optimal. Unfortunately I haven't been able to come up with something better yet.

The way it works at the moment is that the loop starts already behind the intended 'mNextFrameTime'. It then tries to catch up until it falls behind too far (1 second). The CPU is then allowed to take a break and skip a frame. This leads to 'less than 100%' CPU time and unsteady frame rates. These symptoms are even noticeable on fast systems, if you set the desired frame rate to something insane like 500 FPS.

Simply resetting 'mNextFrameTime' to 'getElapsedSeconds()' if we fall behind is not the solution. I will continue working on this until I am completely happy.

For now, the code is still an improvement over the old code in terms of CPU usage, responsiveness and efficiency.