[vtkusers] How to read texture coordinates in a .vtk file?

Wenlong Wang scc.wwl at gmail.com
Fri Jan 11 12:49:20 EST 2013


Hi, all

I am trying to read texture coordinates in a .vtk file. Currently I am
using *vtkGenericDataObjectReader*, the code is like follows:

--------------------------------------
    vtkSmartPointer<vtkGeneriDataObjectReader> reader =
vtkSmartPointer<vtkGeneriDataObjectReader>::New();
    reader->SetFileName("K:\\model1.vtk");
    reader->OpenVTKFile();
    reader->ReadAllTCoordsOn();
    reader->SetTCoordsName("t");
    reader->Update();

    vtkPolyData* face = vtkPolyData::New();
    face = reader->GetPolyDataOutput();
--------------------------------------

But what next? I don't know how to extract the texture coordinates as an
individual data object. Does "face->GetPointData()->GetTCoords()" work? If
so, can I have an example code clip?

Thank you very much in advance for your kindly help.

All bests
Wenlong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130111/a56b691e/attachment.htm>


More information about the vtkusers mailing list