[vtkusers] Modifying vtkPolyData

David Doria daviddoria+vtk at gmail.com
Sun Feb 28 08:46:34 EST 2010


2010/2/27 David Gobbi <david.gobbi at gmail.com>

> Hi Jordi,
>
> Whenever you want to do custom modifications to data that is going
> through the pipeline, the best option is to use one of VTK's
> programmable filters.  In your case, vtkProgrammableFilter is the one
> that you should use.  These programmable filters allow you to set a
> callback function that will do the data modifications as the data
> passes through the pipeline.
>
> You can look at VTK/Graphics/Testing/Tcl/deciPlane.tcl as an example
> of how to use vtkProgrammableFilter.  It's also possible to use them
> in Python, Java, and C++ but I'm not sure if there are good examples
> for those languages.
>
> Animation in VTK should usually be done as follows:
>
> Note that VTK will execute the pipeline automatically whenever
> Render() is called on the window that is displaying the data.  So if
> you want to animate, you usually do it like this:
>
> 1) Use the RenderWindowInteractor to create a repeating timer, and
> make it repeat at your desired frame rate.
> 2) Make an observer for the RenderWindowInteractor TimerEvent
> 3) When a TimerEvent occurs, set the filter parameters for the current
> frame (e.g. the amplitude and phase of your waves), and then call
> Render() on the vtkRenderWindowInteractor.
>
> When you call Render(), VTK will automatically execute the pipeline
> for any data that is displayed in the VTK window. So if you have made
> your filter properly, then it will automatically re-compute all the Z
> positions according to the new parameters.  And because none of the
> Delaunay2D parameters have changed, Delaunay will not re-execute...
> only the filters where things have changed will re-execute when Render
> is called.
>
>   David
>
>
Here is an example of vtkProgrammableFilter in c++:
http://www.vtk.org/Wiki/VTK/Examples/ProgrammableFilter

David G, maybe you can verify that it looks reasonable?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100228/4436d16b/attachment.htm>


More information about the vtkusers mailing list