High-resolution thread sleep

Rene Zwanenburg renezwanenburg at gmail.com
Fri Dec 15 10:43:19 UTC 2017


On Friday, 15 December 2017 at 01:49:56 UTC, Steven Schveighoffer 
wrote:
>
> So... you plan on rendering more than 1000 frames per second?
>
> I think in any case, even if the API allows it, you are 
> probably not getting much better resolution on your non-windows 
> systems.
>
> Have you tried it anyway and see how it works? I think it might 
> actually work just fine.
>
> -Steve

The higher precision would be needed b/c updating and rendering 
takes time, so the sleep time would be timePerFrame - 
timeSpendOnRendering.

Problem is you'll need vsync anyway to avoid tearing. 
Applications that use their own timing to limit the framerate 
without using vsync are easy to recognise: they have a tear 
slowly moving around on the screen. It's visually even more 
annoying than regular tearing.


More information about the Digitalmars-d-learn mailing list