waiting for a small amount of time
-
I would like to show graphics at a fixed 30 fps. The only solution I have is: while (true) { while (not ready) { check the performance timer() } draw() } The problem is that this method pegs the cpu. I would like to use one of these: - SetTimer and handle WM_TIMER - use WaitForSingleObject with a WaitableTimer possibly but they have too low a resolution. Can anyone see another solution? Thanks, Alex Griffing
-
I would like to show graphics at a fixed 30 fps. The only solution I have is: while (true) { while (not ready) { check the performance timer() } draw() } The problem is that this method pegs the cpu. I would like to use one of these: - SetTimer and handle WM_TIMER - use WaitForSingleObject with a WaitableTimer possibly but they have too low a resolution. Can anyone see another solution? Thanks, Alex Griffing
Use timeGettime and draw in your idle time if the right amount of time has passed. This solution will work if your system is too slow to do 30 fps and can be set so things still move at the same speed, albiet not as smoothly, and can clamp the top speed to 30 fps. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
-
I would like to show graphics at a fixed 30 fps. The only solution I have is: while (true) { while (not ready) { check the performance timer() } draw() } The problem is that this method pegs the cpu. I would like to use one of these: - SetTimer and handle WM_TIMER - use WaitForSingleObject with a WaitableTimer possibly but they have too low a resolution. Can anyone see another solution? Thanks, Alex Griffing
Multimedia timers could be called for here. Check Nemanja Trifunovic's Timers tutorial. The minimum resolution attainable with these timers depends on the OS [and the hardware it is running on], but probably it is decent for your needs. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo