[vtkusers] add a vertex attrib
youpie
meriadegp at yahoo.fr
Wed Jun 1 03:38:59 EDT 2011
I finally find how to do and it is very easy :
create a vtkDoubleArray (for example) and set the number of composent into
it (like 3 for example).
give it a name with SetName
Use the method MapDataArrayToVertexAttribute("nameofthevariable",
"vtkDoubleArray->GetName()", vtkDataObject::FIELD_ASSOCIATION_POINTS, -1).
after that, use it in the shader :
attribute vec3 nameofthevariable;
We use vec3 the because we set 3 for the numberOfComposent of the
vtkDoubleArray and that is possible too because we set -1 as a parameter of
the mapper method. I don't know why, but if I choose 3 instead of -1, I have
a little rendering error.
And the tag vtkDataObject::FIELD_ASSOCIATION_POINTS is to set on vec3 per
vertex.
--
View this message in context: http://vtk.1045678.n5.nabble.com/add-a-vertex-attrib-tp4439604p4444427.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list