2 ms·
It's much easier than that, you just need to use the display refresh rate as your time base. In the end, the only important event is when your new frame shows
by flohofwoe 5y ago
It's much easier than that, you just need to use the display refresh rate as your time base.
In the end, the only important event is when your new frame shows up on screen, and this is (a) very precise, and (b) out of your control anyway, at least for traditional fixed-refresh-rate displays.
It doesn't really matter where exactly within a frame-time-slice your per-frame-code runs, or how long it takes as long as it fits comfortably within one display refresh interval, the basic timer resolution that matters is the display refresh rate.
PS: it's more difficult if you also need to minimize input- and networking-latency, that's were it may make sense to to use separate threads I guess. But on desktop PCs (versus game consoles), so much also depends on the operating system playing ball...
PPS: busy looping probably isn't a good idea when power consumption matters (e.g. on mobile)