vtk 2D标注

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;

int main()
{
    vtkSmartPointer cone =
            vtkSmartPointer::New();

    vtkSmartPointer mapper =
            vtkSmartPointer::New();
    mapper->SetInputConnection( cone->GetOutputPort() );

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

    vtkSmartPointer renderer =
            vtkSmartPointer::New();
    renderer->AddActor(actor);
    renderer->SetBackground( 0, 0, 0 );

    vtkSmartPointer renderWindow =
            vtkSmartPointer::New();
    renderWindow->AddRenderer( renderer );

    vtkSmartPointer renderWindowInteractor =
            vtkSmartPointer::New();
    renderWindowInteractor->SetRenderWindow( renderWindow );



    vtkTextActor *textActor = vtkTextActor::New();
    textActor->GetTextProperty()->SetFontSize(30);                // 文字大小
    textActor->SetDisplayPosition(50, 50);                       // 文字位置(左下角)
    textActor->SetInput("ActiViz, C# VTK");                      // 文字内容
    textActor->GetTextProperty()->SetColor(1.0, 0.0, 0.0);        // 文字颜色
    //textActor.GetTextProperty().SetFontFamily(0);               // 字体
    //textActor.GetTextProperty().SetJustification(1);            // 两端对其
    //textActor.GetTextProperty().SetBold(1);                     // 加粗
    //textActor.GetTextProperty().SetItalic(1);                   // 斜体
    //textActor.GetTextProperty().SetShadow(1);                   // 阴影

    renderer->ResetCamera();

    renderer->AddActor( textActor );

    renderWindow->Render();
    renderWindowInteractor->Start();
    return 0;
}


你可能感兴趣的:(vtk,vtk,2D标注)