0
我在visual studio 2010上使用VTK,我想要在立方體面上應用圖像。在立方體面上應用圖像 - VTK
代碼閱讀我的形象:
// Read JPG image
vtkSmartPointer<vtkJPEGReader> JPEGReader = vtkSmartPointer<vtkJPEGReader>::New();
JPEGReader->SetFileName(argv[1]);
JPEGReader->Update();
// Image actor
vtkSmartPointer<vtkImageActor> imageActor = vtkSmartPointer<vtkImageActor>::New();
imageActor->GetMapper()->SetInputData(JPEGReader->GetOutput());
設置立方體代碼:
// Setup cube
vtkSmartPointer<vtkCubeSource> cubeSource = vtkSmartPointer<vtkCubeSource>::New();
cubeSource->Update();
vtkSmartPointer<vtkPolyDataMapper> cubeMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
cubeMapper->SetInputConnection(cubeSource->GetOutputPort());
vtkSmartPointer<vtkActor> cubeActor = vtkSmartPointer<vtkActor>::New();
cubeActor->SetMapper(cubeMapper);
cubeActor->GetProperty()->SetDiffuseColor(.3, .6, .4);
我怎麼做到的?