-
- Downloads
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
Showing
- Base/SimulationManager/imstkVTKInteractorStyle.cpp 54 additions, 7 deletionsBase/SimulationManager/imstkVTKInteractorStyle.cpp
- Base/SimulationManager/imstkVTKInteractorStyle.h 19 additions, 1 deletionBase/SimulationManager/imstkVTKInteractorStyle.h
- Base/SimulationManager/imstkVTKViewer.cpp 17 additions, 2 deletionsBase/SimulationManager/imstkVTKViewer.cpp
- Base/SimulationManager/imstkVTKViewer.h 10 additions, 0 deletionsBase/SimulationManager/imstkVTKViewer.h
Please register or sign in to comment