1 vtk安装记录

1 下载源文件

官网
http://www.vtk.org/
百度云链接:
http://pan.baidu.com/s/1pLjRdOn 密码: dgvh
一个为source,一个为data,一个为参考文档

2 用cmake加上vs2013编译

参考1
VTK与ITK的详细安装指南
http://blog.csdn.net/Chinamming/article/details/16802787
参考2
VTK配置步骤(WIN7 64位 + VS2012 + VTK-5.10.1)
http://blog.csdn.net/yunhaic/article/details/40653221
参考3
模仿opencv安装时添加相应dll文件
http://blog.csdn.net/poem_qianmo/article/details/19809337
参考4
no override found for vtkpolydatamapper解决方法
http://blog.csdn.net/xieyi4650/article/details/50395733
参考5
维基vtk c++例子
http://www.vtk.org/Wiki/VTK/Examples/Cxx

3 测试

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
//解决no override found for vtkpolydatamapper
#include 
VTK_MODULE_INIT(vtkRenderingOpenGL)

int main(int, char *[])
{
    // Create a plane
    vtkSmartPointer planeSource =
        vtkSmartPointer::New();
    planeSource->SetCenter(1.0, 0.0, 0.0);
    planeSource->SetNormal(1.0, 0.0, 1.0);
    planeSource->Update();

    vtkPolyData* plane = planeSource->GetOutput();

    // Create a mapper and actor
    vtkSmartPointer mapper =
        vtkSmartPointer::New();
#if VTK_MAJOR_VERSION <= 5
    mapper->SetInput(plane);
#else
    mapper->SetInputData(plane);
#endif

    vtkSmartPointer actor =
        vtkSmartPointer::New();
    actor->SetMapper(mapper);

    // Create a renderer, render window and interactor
    vtkSmartPointer renderer =
        vtkSmartPointer::New();
    vtkSmartPointer renderWindow =
        vtkSmartPointer::New();
    renderWindow->AddRenderer(renderer);
    vtkSmartPointer renderWindowInteractor =
        vtkSmartPointer::New();
    renderWindowInteractor->SetRenderWindow(renderWindow);

    // Add the actors to the scene
    renderer->AddActor(actor);
    renderer->SetBackground(.1, .2, .3); // Background color dark blue

    // Render and interact
    renderWindow->Render();
    renderWindowInteractor->Start();

    return EXIT_SUCCESS;
}

1 vtk安装记录_第1张图片

你可能感兴趣的:(vtk)