VS2017+VTK8.2配置记录

环境:vs2017+vtk8.2

注:自用debug模式

先配置环境变量:E:\VTK\VTK8.2.0\bin\debugX64

然后vs新建项目后配置项目属性:(注意是debug和x64)

VS2017+VTK8.2配置记录

配置链接器:属性 ——> 链接器 ——> 输入 ——> 附加依赖项

  把 E:\VTK\VTK8.2.0\lib\debugX64下所有lib名字输入进来。

  这里的是下面这些库。然后编译就可以了。

vtkChartsCore-8.2.lib
vtkCommonColor-8.2.lib
vtkCommonComputationalGeometry-8.2.lib
vtkCommonCore-8.2.lib
vtkCommonDataModel-8.2.lib
vtkCommonExecutionModel-8.2.lib
vtkCommonMath-8.2.lib
vtkCommonMisc-8.2.lib
vtkCommonSystem-8.2.lib
vtkCommonTransforms-8.2.lib
vtkDICOMParser-8.2.lib
vtkDomainsChemistry-8.2.lib
vtkDomainsChemistryOpenGL2-8.2.lib
vtkdoubleconversion-8.2.lib
vtkexodusII-8.2.lib
vtkexpat-8.2.lib
vtkFiltersAMR-8.2.lib
vtkFiltersCore-8.2.lib
vtkFiltersExtraction-8.2.lib
vtkFiltersFlowPaths-8.2.lib
vtkFiltersGeneral-8.2.lib
vtkFiltersGeneric-8.2.lib
vtkFiltersGeometry-8.2.lib
vtkFiltersHybrid-8.2.lib
vtkFiltersHyperTree-8.2.lib
vtkFiltersImaging-8.2.lib
vtkFiltersModeling-8.2.lib
vtkFiltersParallel-8.2.lib
vtkFiltersParallelImaging-8.2.lib
vtkFiltersPoints-8.2.lib
vtkFiltersProgrammable-8.2.lib
vtkFiltersSelection-8.2.lib
vtkFiltersSMP-8.2.lib
vtkFiltersSources-8.2.lib
vtkFiltersStatistics-8.2.lib
vtkFiltersTexture-8.2.lib
vtkFiltersTopology-8.2.lib
vtkFiltersVerdict-8.2.lib
vtkfreetype-8.2.lib
vtkGeovisCore-8.2.lib
vtkgl2ps-8.2.lib
vtkglew-8.2.lib
vtkhdf5-8.2.lib
vtkhdf5_hl-8.2.lib
vtkImagingColor-8.2.lib
vtkImagingCore-8.2.lib
vtkImagingFourier-8.2.lib
vtkImagingGeneral-8.2.lib
vtkImagingHybrid-8.2.lib
vtkImagingMath-8.2.lib
vtkImagingMorphological-8.2.lib
vtkImagingSources-8.2.lib
vtkImagingStatistics-8.2.lib
vtkImagingStencil-8.2.lib
vtkInfovisCore-8.2.lib
vtkInfovisLayout-8.2.lib
vtkInteractionImage-8.2.lib
vtkInteractionStyle-8.2.lib
vtkInteractionWidgets-8.2.lib
vtkIOAMR-8.2.lib
vtkIOAsynchronous-8.2.lib
vtkIOCityGML-8.2.lib
vtkIOCore-8.2.lib
vtkIOEnSight-8.2.lib
vtkIOExodus-8.2.lib
vtkIOExport-8.2.lib
vtkIOExportOpenGL2-8.2.lib
vtkIOExportPDF-8.2.lib
vtkIOGeometry-8.2.lib
vtkIOImage-8.2.lib
vtkIOImport-8.2.lib
vtkIOInfovis-8.2.lib
vtkIOLegacy-8.2.lib
vtkIOLSDyna-8.2.lib
vtkIOMINC-8.2.lib
vtkIOMovie-8.2.lib
vtkIONetCDF-8.2.lib
vtkIOParallel-8.2.lib
vtkIOParallelXML-8.2.lib
vtkIOPLY-8.2.lib
vtkIOSegY-8.2.lib
vtkIOSQL-8.2.lib
vtkIOTecplotTable-8.2.lib
vtkIOVeraOut-8.2.lib
vtkIOVideo-8.2.lib
vtkIOXML-8.2.lib
vtkIOXMLParser-8.2.lib
vtkjpeg-8.2.lib
vtkjsoncpp-8.2.lib
vtklibharu-8.2.lib
vtklibxml2-8.2.lib
vtkLocalExample-8.2.lib
vtklz4-8.2.lib
vtklzma-8.2.lib
vtkmetaio-8.2.lib
vtkNetCDF-8.2.lib
vtkogg-8.2.lib
vtkParallelCore-8.2.lib
vtkpng-8.2.lib
vtkproj-8.2.lib
vtkpugixml-8.2.lib
vtkRenderingAnnotation-8.2.lib
vtkRenderingContext2D-8.2.lib
vtkRenderingContextOpenGL2-8.2.lib
vtkRenderingCore-8.2.lib
vtkRenderingFreeType-8.2.lib
vtkRenderingGL2PSOpenGL2-8.2.lib
vtkRenderingImage-8.2.lib
vtkRenderingLabel-8.2.lib
vtkRenderingLOD-8.2.lib
vtkRenderingOpenGL2-8.2.lib
vtkRenderingVolume-8.2.lib
vtkRenderingVolumeOpenGL2-8.2.lib
vtksqlite-8.2.lib
vtksys-8.2.lib
vtktheora-8.2.lib
vtktiff-8.2.lib
vtkverdict-8.2.lib
vtkViewsContext2D-8.2.lib
vtkViewsCore-8.2.lib
vtkViewsInfovis-8.2.lib
vtkzlib-8.2.lib

 vs新建一个项目,输入代码:

 1 #include <vtkAutoInit.h>
 2 VTK_MODULE_INIT(vtkRenderingOpenGL2);
 3 VTK_MODULE_INIT(vtkInteractionStyle);
 4 
 5 #include <vtkActor.h>
 6 #include <vtkCamera.h>
 7 #include <vtkCellArray.h>
 8 #include <vtkFloatArray.h>
 9 #include <vtkNamedColors.h>
10 #include <vtkNew.h>
11 #include <vtkPointData.h>
12 #include <vtkPoints.h>
13 #include <vtkPolyData.h>
14 #include <vtkPolyDataMapper.h>
15 #include <vtkRenderWindow.h>
16 #include <vtkRenderWindowInteractor.h>
17 #include <vtkRenderer.h>
18 #include <array>
19 int main()
20 {
21     vtkNew<vtkNamedColors> colors;
22 
23     std::array<std::array<double, 3>, 8> pts = { {{{0, 0, 0}},
24                                                  {{1, 0, 0}},
25                                                  {{1, 1, 0}},
26                                                  {{0, 1, 0}},
27                                                  {{0, 0, 1}},
28                                                  {{1, 0, 1}},
29                                                  {{1, 1, 1}},
30                                                  {{0, 1, 1}}} };
31     // The ordering of the corner points on each face.
32     std::array<std::array<vtkIdType, 4>, 6> ordering = { {{{0, 1, 2, 3}},
33                                                          {{4, 5, 6, 7}},
34                                                          {{0, 1, 5, 4}},
35                                                          {{1, 2, 6, 5}},
36                                                          {{2, 3, 7, 6}},
37                                                          {{3, 0, 4, 7}}} };
38 
39     // We'll create the building blocks of polydata including data attributes.
40     vtkNew<vtkPolyData> cube;
41     vtkNew<vtkPoints> points;
42     vtkNew<vtkCellArray> polys;
43     vtkNew<vtkFloatArray> scalars;
44 
45     // Load the point, cell, and data attributes.
46     for (auto i = 0ul; i < pts.size(); ++i)
47     {
48         points->InsertPoint(i, pts[i].data());
49         scalars->InsertTuple1(i, i);
50     }
51     for (auto&& i : ordering)
52     {
53         polys->InsertNextCell(vtkIdType(i.size()), i.data());
54     }
55 
56     // We now assign the pieces to the vtkPolyData.
57     cube->SetPoints(points);
58     cube->SetPolys(polys);
59     cube->GetPointData()->SetScalars(scalars);
60 
61     // Now we'll look at it.
62     vtkNew<vtkPolyDataMapper> cubeMapper;
63     cubeMapper->SetInputData(cube);
64     cubeMapper->SetScalarRange(cube->GetScalarRange());
65     vtkNew<vtkActor> cubeActor;
66     cubeActor->SetMapper(cubeMapper);
67 
68     // The usual rendering stuff.
69     vtkNew<vtkCamera> camera;
70     camera->SetPosition(1, 1, 1);
71     camera->SetFocalPoint(0, 0, 0);
72 
73     vtkNew<vtkRenderer> renderer;
74     vtkNew<vtkRenderWindow> renWin;
75     renWin->AddRenderer(renderer);
76 
77     vtkNew<vtkRenderWindowInteractor> iren;
78     iren->SetRenderWindow(renWin);
79 
80     renderer->AddActor(cubeActor);
81     renderer->SetActiveCamera(camera);
82     renderer->ResetCamera();
83     renderer->SetBackground(colors->GetColor3d("Cornsilk").GetData());
84 
85     renWin->SetSize(600, 600);
86 
87     // interact with data
88     renWin->Render();
89     iren->Start();
90 
91     return EXIT_SUCCESS;
92 }

编译运行可得结果如图:

VS2017+VTK8.2配置记录

 

 

 

vtkChartsCore-8.2.libvtkCommonColor-8.2.libvtkCommonComputationalGeometry-8.2.libvtkCommonCore-8.2.libvtkCommonDataModel-8.2.libvtkCommonExecutionModel-8.2.libvtkCommonMath-8.2.libvtkCommonMisc-8.2.libvtkCommonSystem-8.2.libvtkCommonTransforms-8.2.libvtkDICOMParser-8.2.libvtkDomainsChemistry-8.2.libvtkDomainsChemistryOpenGL2-8.2.libvtkdoubleconversion-8.2.libvtkexodusII-8.2.libvtkexpat-8.2.libvtkFiltersAMR-8.2.libvtkFiltersCore-8.2.libvtkFiltersExtraction-8.2.libvtkFiltersFlowPaths-8.2.libvtkFiltersGeneral-8.2.libvtkFiltersGeneric-8.2.libvtkFiltersGeometry-8.2.libvtkFiltersHybrid-8.2.libvtkFiltersHyperTree-8.2.libvtkFiltersImaging-8.2.libvtkFiltersModeling-8.2.libvtkFiltersParallel-8.2.libvtkFiltersParallelImaging-8.2.libvtkFiltersPoints-8.2.libvtkFiltersProgrammable-8.2.libvtkFiltersSelection-8.2.libvtkFiltersSMP-8.2.libvtkFiltersSources-8.2.libvtkFiltersStatistics-8.2.libvtkFiltersTexture-8.2.libvtkFiltersTopology-8.2.libvtkFiltersVerdict-8.2.libvtkfreetype-8.2.libvtkGeovisCore-8.2.libvtkgl2ps-8.2.libvtkglew-8.2.libvtkhdf5-8.2.libvtkhdf5_hl-8.2.libvtkImagingColor-8.2.libvtkImagingCore-8.2.libvtkImagingFourier-8.2.libvtkImagingGeneral-8.2.libvtkImagingHybrid-8.2.libvtkImagingMath-8.2.libvtkImagingMorphological-8.2.libvtkImagingSources-8.2.libvtkImagingStatistics-8.2.libvtkImagingStencil-8.2.libvtkInfovisCore-8.2.libvtkInfovisLayout-8.2.libvtkInteractionImage-8.2.libvtkInteractionStyle-8.2.libvtkInteractionWidgets-8.2.libvtkIOAMR-8.2.libvtkIOAsynchronous-8.2.libvtkIOCityGML-8.2.libvtkIOCore-8.2.libvtkIOEnSight-8.2.libvtkIOExodus-8.2.libvtkIOExport-8.2.libvtkIOExportOpenGL2-8.2.libvtkIOExportPDF-8.2.libvtkIOGeometry-8.2.libvtkIOImage-8.2.libvtkIOImport-8.2.libvtkIOInfovis-8.2.libvtkIOLegacy-8.2.libvtkIOLSDyna-8.2.libvtkIOMINC-8.2.libvtkIOMovie-8.2.libvtkIONetCDF-8.2.libvtkIOParallel-8.2.libvtkIOParallelXML-8.2.libvtkIOPLY-8.2.libvtkIOSegY-8.2.libvtkIOSQL-8.2.libvtkIOTecplotTable-8.2.libvtkIOVeraOut-8.2.libvtkIOVideo-8.2.libvtkIOXML-8.2.libvtkIOXMLParser-8.2.libvtkjpeg-8.2.libvtkjsoncpp-8.2.libvtklibharu-8.2.libvtklibxml2-8.2.libvtkLocalExample-8.2.libvtklz4-8.2.libvtklzma-8.2.libvtkmetaio-8.2.libvtkNetCDF-8.2.libvtkogg-8.2.libvtkParallelCore-8.2.libvtkpng-8.2.libvtkproj-8.2.libvtkpugixml-8.2.libvtkRenderingAnnotation-8.2.libvtkRenderingContext2D-8.2.libvtkRenderingContextOpenGL2-8.2.libvtkRenderingCore-8.2.libvtkRenderingFreeType-8.2.libvtkRenderingGL2PSOpenGL2-8.2.libvtkRenderingImage-8.2.libvtkRenderingLabel-8.2.libvtkRenderingLOD-8.2.libvtkRenderingOpenGL2-8.2.libvtkRenderingVolume-8.2.libvtkRenderingVolumeOpenGL2-8.2.libvtksqlite-8.2.libvtksys-8.2.libvtktheora-8.2.libvtktiff-8.2.libvtkverdict-8.2.libvtkViewsContext2D-8.2.libvtkViewsCore-8.2.libvtkViewsInfovis-8.2.libvtkzlib-8.2.lib

上一篇:开源自建/托管与商业化自研 Trace,如何选择?


下一篇:square-and-multiply algorithm