[vtkusers] C# ActiViz.NET 5.8.0 mapper issue

Benjamin Jähn jaminus_jahnatos at freenet.de
Fri Mar 1 02:19:26 EST 2013


Hey...

if you want to do some changes in the pipeline during runtime you have 
to do this within the pipeline via callbacks in the same thread where 
the pipeline runs.
Within the callback you have to call Modified to the object you have 
changed and you should call Render() to the RenderWindowInteractor.

Regards,
Benjamin Jähn

Am 28.02.2013 22:01, schrieb Michel Delanaye - Geonx:
>
> Dear vtk users,
>
> I am using a vtkUnsignedCharArray to define the color of triangles 
> belonging to a VtkUnstructuredGrid (code snippet 1). Everything works 
> well for rendering and the mesh is correctly displayed. However, if I 
> change the color of some of the triangles after rendering, which can 
> be done by modifying the Tuple for the specific triangles in the 
> colors array, the view does not get updated and colors are not 
> changed. I have tried many functions of the mapper, but nothing seems 
> to work except allocating a new mapper and linking it to the 
> VtkUnstructuredGrid object (see code snippet 2) . I think this is a 
> strange behavior.
>
> If anyone faced a similar behavior, I would be interested to get in touch.
>
> Best regards,
>
> -Michel Delanaye
>
> geonX SA
>
> //Code snippet 1
>
> vtkUnsignedCharArraycolors = vtkUnsignedCharArray.New();
>
> colors.Allocate(Model.VtkUNS.GetNumberOfCells(),1000);
>
>             colors.SetNumberOfComponents(3);
>
>             colors.SetName("Colors");
>
> Model.VtkUNS.GetCellData().SetScalars(colors);
>
> for(intj = 0; j < Model.VtkUNS.GetNumberOfCells(); j++)
>
>             {
>
> colors.InsertNextTupleValue(p_default_color);
>
>             }
>
> Marshal.FreeHGlobal(p_default_color);
>
> vtkDataSetMappermapper = vtkDataSetMapper.New();
>
> _visualization_triangulation.SetMapper(mapper);
>
>             mapper.ImmediateModeRenderingOn();
>
>             mapper.SetInput(Model.VtkUNS);
>
>             mapper.ImmediateModeRenderingOn();
>
>             mapper.ScalarVisibilityOn();
>
> ... do rendering etc
>
> // Code snippet 2
>
> vtkUnsignedCharArraycolors = (vtkUnsignedCharArray) 
> Model.VtkUNS.GetCellData().GetArray("Colors", refindex);
>
> foreach(longi inf.VtkTriangleIdList)
>
>             {
>
>                colors.SetTupleValue((long)i, p_picking_color);
>
>             }
>
> vtkDataSetMappermapper = vtkDataSetMapper.New();
>
> _visualization_triangulation.SetMapper(mapper);
>
>             mapper.SetInput(Model.VtkUNS);
>
>             mapper.ImmediateModeRenderingOn();
>
>             mapper.ScalarVisibilityOn();
>
> ...
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130301/9c7bb42d/attachment.htm>


More information about the vtkusers mailing list