标签:
vtkNew<vtkPoints> points; points->SetNumberOfPoints(4); points->SetPoint(0, 0, 0, 0); points->SetPoint(1, 1, 0, 0); points->SetPoint(2, 1, 1, 0); points->SetPoint(3, 0, 1, 0); vtkNew<vtkCellArray> polygons; polygons->InsertNextCell(4); polygons->InsertCellPoint(0); polygons->InsertCellPoint(1); polygons->InsertCellPoint(2); polygons->InsertCellPoint(3); vtkNew<vtkFloatArray> texcoord; texcoord->SetNumberOfComponents(3); double t0[] = {0, 0, 0}; double t1[] = {1, 0, 0}; double t2[] = {1, 1, 0}; double t3[] = {0, 1, 0}; texcoord->InsertNextTuple(t0); texcoord->InsertNextTuple(t1); texcoord->InsertNextTuple(t2); texcoord->InsertNextTuple(t3); vtkNew<vtkPolyData> polydata; polydata->SetPoints(points.GetPointer()); polydata->SetPolys(polygons.GetPointer()); polydata->GetPointData()->SetTCoords(texcoord.GetPointer()); vtkNew<vtkPolyDataMapper> mapper; mapper->SetInputData(polydata.GetPointer()); vtkNew<vtkPNGReader> png; png->SetFileName("/home/cc/1.png"); vtkNew<vtkTexture> texture; texture->SetInputConnection(png->GetOutputPort()); vtkNew<vtkActor> actor; actor->RotateX(90); actor->SetMapper(mapper.GetPointer()); actor->SetTexture(texture.GetPointer());
标签:
原文地址:http://www.cnblogs.com/nmgxbc/p/5594213.html