程序运行环境vs2013,release,64位。
包含目录:(附件vtk-5.8.0解压目录)\vtk-5.8.0;(附件bin-64位release解压目录)\bin
库目录:(附件bin-64位release解压目录\bin\bin\Release
附加依赖项:
CommonCxxTests.lib;Cosmo.lib;MapReduceMPI.lib;mpistubs.lib;QVTK.lib;QVTKWidgetPlugin.lib;VPIC.lib;vtkalglib.lib;vtkCharts.lib;vtkCommon.lib;vtkDICOMParser.lib;vtkexoIIc.lib;vtkexpat.lib;vtkFiltering.lib;vtkfreetype.lib;vtkftgl.lib;vtkGenericFiltering.lib;vtkGeovis.lib;vtkGraphics.lib;vtkhdf5.lib;vtkHybrid.lib;vtkImaging.lib;vtkInfovis.lib;vtkIO.lib;vtkjpeg.lib;vtklibxml2.lib;vtkmetaio.lib;vtkmyCommon.lib;vtkmyImaging.lib;vtkmyUnsorted.lib;vtkNetCDF.lib;vtkNetCDF_cxx.lib;vtkParallel.lib;vtkpng.lib;vtkproj4.lib;vtkRendering.lib;vtksqlite.lib;vtksys.lib;vtktiff.lib;vtkverdict.lib;vtkViews.lib;vtkVolumeRendering.lib;vtkWidgets.lib;vtkzlib.lib;
程序代码:
#include "vtkCylinderSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkProperty.h"
#include "vtkCamera.h"
int main()
{
/*首先创建一个棱柱,vtkCylinderSource继承自vtkPolyDataAlgorithm类,生成vtkPolyData对象*/
vtkCylinderSource *cylinder = vtkCylinderSource::New();
cylinder->SetResolution(8);
/*vtkPolyDataMapper用来定义vtkPolyData信息,如颜色等,而后将信息映射到形体*/
vtkPolyDataMapper *cylinderMapper = vtkPolyDataMapper::New();
cylinderMapper->SetInputConnection(cylinder->GetOutputPort());
/*上面定义了几何特性,接下来定义视角和纹理,下面代码定义了视角和颜色*/
vtkActor *cylinderActor = vtkActor::New();
cylinderActor->SetMapper(cylinderMapper);
cylinderActor->GetProperty()->SetColor(1.0000, 0.3882, 0.2784);
cylinderActor->RotateX(30.0);
cylinderActor->RotateY(-45.0);
/*创建图形结构,渲染窗口加载渲染器,渲染窗口捕获不同的鼠标事件进行不同的操作*/
vtkRenderer *ren1 = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren1);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
/*加载渲染器,设置渲染窗口和大小*/
ren1->AddActor(cylinderActor);
ren1->SetBackground(0.1, 0.2, 0.4);
renWin->SetSize(200, 200);
/*设置图形的放大缩小*/
ren1->ResetCamera();
ren1->GetActiveCamera()->Zoom(1.5);
renWin->Render();
/*启动渲染*/
iren->Start();
/*程序结束,删除所有实例*/
cylinder->Delete();
cylinderMapper->Delete();
cylinderActor->Delete();
ren1->Delete();
renWin->Delete();
iren->Delete();
return 0;
}
编译好的vtk
bin-64位release.rar:
http://pan.baidu.com/s/1miPFfYC(vs10编译,64位release版,经测试vs13也可用)
vtk-5.8.0:http://pan.baidu.com/s/1boAijef
vtkdata-5.8.0:http://pan.baidu.com/s/1eSNj3XK