Eric,

I too am interested in texture mapping a 3d mesh object (having texture coordinates). How to I use the script you provided?

In addition, I know the mesh can be in PVD format, but how do I specify the texture coordinates as well as the texture?

Thanks,

- Olumide


# SCRIPT ....
# =============
pdi = self.GetPolyDataInput()
pdo = self.GetPolyDataOutput()

numPts = pdi.GetPoints().GetNumberOfPoints()
Uarray = pdi.GetPointData().GetArray('U')
Varray = pdi.GetPointData().GetArray('V')

tc = vtk.vtkDoubleArray()
tc.SetNumberOfComponents(2)
tc.SetNumberOfTuples(numPts)
tc.SetName('TCoords')

for ii in range(numPts):
  Uval = Uarray.GetTuple1(ii)
  Vval = Varray.GetTuple1(ii)
  tc.SetTuple2(ii,Uval,Vval)

pdo.ShallowCopy(pdi)
pdo.GetPointData().AddArray(tc)
pdo.GetPointData().SetActiveTCoords('TCoords')
# =============
_______________________________________________
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 ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to