![]() |
#1
|
|||
|
|||
Timer speed
1) What determines the maximum speed of a timer loop?
Obviously if you are trying to make a visual change, such as turning a light on and off, there is no point in making the timer go faster than the frame rate of the video card. But if the timer loop just makes a simple calculation, say incrementing a variable, how fast can you make it go? 2) What happens if the loop contains a complex mathematical calculation that takes longer than the period you specify for the timer? When the timer times out and the previous calculation has not had time to complete does it restart the calculation or just ignore timeouts until the calculation has finished? |
#2
|
|||
|
|||
Timers are not multi-threaded, they run in the same thread as the main graphics loop. If your framerate is 60 fps, then your timer cannot go any faster than 60 Hz.
If you have a timer that takes a long time to calculate, then it will stall the entire graphics loop. No other code will be executed until your timer is finished doing its calculations. |
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|