Skip to content

Improve render clock

VTKInteractorStyle::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 uniform frame rate, because the time spent within 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 frame rate.

Also added a commit to use DATA_DIR defined in the Sandbox example to easily change the data directory for each user on their own machine. Any local change to the DATA_DIR value should not be committed in the future.

Merge request reports