[vtkusers] How to re-render on input data updates
Marc Cotran
marc at cotran.ca
Tue Sep 12 10:37:21 EDT 2006
Andy Treisch wrote:
> Hi!
>
> I created a rendering pipeline, which is based on a vtkImageData. It is
> constructed by x and y coordinates and the "values" of the points added
> via ->GetPointData()->SetScalars() method. During runtime, the scalar
> data will change and i need to update my rendering window. how can I
> do that? I tried to add an Observer to the vtkRenderWindowInteractor
> using eventid = AddObserver(vtkCommand::UserEvent, cbc, 1.0) with
> cbc beeing an instance of vtkCallbackCommand with my update function
> set via ->SetCallback(). As far as I understand the doxygen
> documentation, eventid should hold a value, which is needed to invoke
> the event. When I try to iren->InvokeEvent(eventid) nothing happens.
> I also tried InvokeEvent(vtkCommand::UserEvent) but nothing happens,
> too. So I tried to change the event to a LeftButtonPressEvent resulting
> in AddObserver(vtkCommand::LeftButtonPressEvent, ...) and it works.
> But it only updates the plot if I click inside the renderwindow.
>
> Is there any other way to update the renderwindow on changed basedata
> or did I understand something wrong with the use of the Observer-system?
> I work on that since about a week and it drives me crazy...
You might need to force your vtkImageData to update via a call to
vtkImageData::Update() once you add the new scalars. If the rest of the
pipeline doesn't update automatically, try updating a downstream
pipeline object (your mapper) as well.
hth
Marc
More information about the vtkusers
mailing list