Skip to content
Snippets Groups Projects
Commit de900528 authored by Alexis Girault's avatar Alexis Girault
Browse files

ENH: Update timer in vtkInteractor to meet target fps

vtkInteractor::CreateRepeatingTimer would call
vtkInteractorStyle::OnTimer then sleep for the period
given in ms after calling OnTimer again. This isn't
adapted for rendering at a regular framerate, because
the time taken withing the OnTimer function is not
taken into account in the sleep time.

By using OneShotTimer, we can manipulate when to
render the next frame: in (period - time spent) ms
if the time spent in OnTimer is smaller than the period
time, or right away (period of 0 ms) if the time spent
is over the target period (late frame).

An interface is added in the VTKInteractorStyle,
wrapped in the VTKViewer, to set the target framerate.

Default value is 0ms to render as fast as possible. See:
: http://gaming.stackexchange.com/questions/221423/is-there-any-reason-to-limit-my-fps
parent ed4ee276
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment