[vtkusers] How to set texture coordinates?

David C Thompson dcthomp at sandia.gov
Mon Apr 28 18:57:12 EDT 2008


> is it possible to set texture coordinates for a polydata-structure?
Yes, and for unstructured grids as well.

> I think there should be an easier way to set the (u,v) or (s,t)
> coordinates for each vertex, instead of using the texture mapping
> classes like vtkTextureMapToPlane, ...Sphere or ...Cylinder.
  vtkPolyData* pd;
  vtkFloatArray* tc = vtkFloatArray::New();
  tc->SetNumberOfComponents( 2 );
  // ... fill in texture coordinates for each vertex ...
  pd->GetPointData()->SetTCoords( tc );
  tc->FastDelete();

	David





More information about the vtkusers mailing list