The documentation on Timer states the following:
The time interval isn't guaranteed to be precise to any more than maybe 10-20ms, and the intervals may end up being much longer than requested if the system is busy. Because the callbacks are made by the main message thread, anything that blocks the message queue for a period of time will also prevent any timers from running until it can carry on.
So assuming we are using a Timer to trigger repaint() on a given component, then that call will be later than desired, by some amount. Then by nature of the message thread, there will be another delay between repaint() and the actual execution of paint().
This poses an issue when drawing moving components. You will end up with different times between each individual paint(), or frame. I have personally noticed this, animations are a bit stuttered, caused by each frame being timed differently.
I understand why this happens, and that there isn’t anything that can be done, other than trying to have less activity on the message thread, so that there are fewer delays.
This leads me to my question… What are the alternatives? From what I can tell, it is to have the component inherit from OpenGLRenderer, and draw everything with shaders. Is this the only way to decouple your draw calls from the message thread, and eliminate the delay issues of the timer/repaint callbacks?
Thanks for reading, I hope everyone is keeping safe.