vtkRenderWindow中添加按钮

这里写图片描述

图中黑白的的地方为按钮

demo:https://lorensen.github.io/VTKExamples/site/Cxx/Widgets/TexturedButtonWidget/

//将viewport坐标转为屏幕坐标

    vtkSmartPointer<vtkCoordinate> upperRight =
      vtkSmartPointer<vtkCoordinate>::New();
    upperRight->SetCoordinateSystemToNormalizedDisplay();
    upperRight->SetValue(1.0, 1.0);

    double bds[6];
    double sz = 50.0;
    bds[0] = upperRight->GetComputedDisplayValue(renderer)[0] - sz;
    bds[1] = bds[0] + sz;
    bds[2] = upperRight->GetComputedDisplayValue(renderer)[1] - sz;
    bds[3] = bds[2] + sz;
    bds[4] = bds[5] = 0.0;

猜你喜欢

转载自blog.csdn.net/yuxing55555/article/details/80611349