[vtkusers] Display mesh with attributes

David Doria daviddoria at gmail.com
Tue Aug 14 11:26:41 EDT 2012


On Tue, Aug 14, 2012 at 11:18 AM, agatte <agatakrason at gmail.com> wrote:

> Hi ;)
>
> I have a question.
> I have already red mesh with attributes (in file).
> But I can't display corectly  mesh with attributes in VTK.
> I receive only one color. But When I open file in paraview, I can display
> well mesh & attributes  with colors.
> Could anyone help me please ? What is it wrong in this code  ? What should
> I
> add ?
> I would appreciate for any help please.
>

I would suggest looking through some of the examples:

http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/TriangleColoredPoints

and you should always try to generate the situation you are having in the
smallest possible compilable, self contained code. That is, don't read a
file, generate data programmatically (vtkSphereSource, etc). Remove all
extraneous calls (you have a writer in the above code that doesn't seem
necessary).

Also, you should use smart pointers instead of normal pointers so you don't
need the giant block of Delete() calls at the bottom (it makes the code
longer and less appealing to look at for us at a glance).

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120814/311f4390/attachment.htm>


More information about the vtkusers mailing list