文章目錄
- 參考博客
- 1、 VTK下載和編譯
- 2、vs2019配置vtk9.3.1
參考博客
Visual Studio 2022 配置VTK9.3.0
1、 VTK下載和編譯
見博客
CMake編譯VTK
2、vs2019配置vtk9.3.1
新建一個項目
寫入以下代碼
#include <vtkActor.h>
#include <vtkAssembly.h>
#include <vtkCubeSource.h>
#include <vtkNamedColors.h>
#include <vtkNew.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkRenderWindow.h>
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkSphereSource.h>
#include <vtkTransform.h>
#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkInteractionStyle);int main(int, char* [])
{vtkNew<vtkNamedColors> namedColors;// Create a sphere.vtkNew<vtkSphereSource> sphereSource;sphereSource->Update();vtkNew<vtkPolyDataMapper> sphereMapper;sphereMapper->SetInputConnection(sphereSource->GetOutputPort());vtkNew<vtkActor> sphereActor;sphereActor->SetMapper(sphereMapper);sphereActor->GetProperty<