Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
519 views
in Technique[技术] by (71.8m points)

c++ - What's the most accurate way to limit FPS on Windows?

So I'm using a call like:

Sleep(16 - millisecondsElapsed);

at the end of every frame draw in my program loop to limit it to 60fps. But if you do the math, 1000ms / 16ms/frames = 62.5frames, and the way I count frames in my program reflects this. You would need to sleep for ~16.67ms to be accurate. As far as I know, there is no way to sleep for less than a millisecond on Windows.

So what would be the most accurate way to limit FPS?

question from:https://stackoverflow.com/questions/65863974/whats-the-most-accurate-way-to-limit-fps-on-windows

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...