问题
There is a simulation application which outputs some vtk point data every timestep and I would like to render this data at every timestep and also keep it interactive.
I have created a pipeline which takes simulation points (points->SetInputData(data)
) as an input and applies a set of filters to it. For the sake of testing I've created a simple timer and added an observer reacting on the timer event:
renderWindowInteractor->AddObserver(vtkCommand::TimerEvent, cb);
int timerId = renderWindowInteractor->CreateRepeatingTimer(1000);
This works just as I want it. The only problem left is to add a custom user event. Basically I want to trigger some event at the end of each simulation timestep and update the model in the render window. I saw some of the VTK examples but I still don't get how to do this for my case. Could anyone help?
回答1:
If you connect the visualization pipeline using SetInputConnection connected to the filter, then all you have to do is call Render() on the render window periodically.
来源:https://stackoverflow.com/questions/33504846/vtk-update-data-points-in-renderwindow-at-every-simulation-timestep