The next frame's time stamp needs to be computed based on the last frame's, rather than the current time. This ensures that the frame rate is consistent even when some frames take longer to draw than others. This is especially noticeable in debug builds where drawing frames may take much longer than in release builds. My VIZIA GUIs can now run at almost full speed (60-67 FPS) whereas previously the frame rate was in the low 20s at best.
The poll() also needs to compute the delay using the then current time, as the now() from the start of the function doesn't account for the time already spent handling events and drawing frames.
The next frame's time stamp needs to be computed based on the last frame's, rather than the current time. This ensures that the frame rate is consistent even when some frames take longer to draw than others. This is especially noticeable in debug builds where drawing frames may take much longer than in release builds. My VIZIA GUIs can now run at almost full speed (60-67 FPS) whereas previously the frame rate was in the low 20s at best.
The
poll()
also needs to compute the delay using the then current time, as thenow()
from the start of the function doesn't account for the time already spent handling events and drawing frames.