Advertisement
NoeMurr

vtkRenderWindowInteractor Error under macOS cpp

Apr 19th, 2019
280
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <vtkActor.h>
  2. #include <vtkCamera.h>
  3. #include <vtkConeSource.h>
  4. #include <vtkNamedColors.h>
  5. #include <vtkNew.h>
  6. #include <vtkPolyDataMapper.h>
  7. #include <vtkRenderWindow.h>
  8. #include <vtkRenderer.h>
  9. #include <vtkRenderWindowInteractor.h>
  10.  
  11. int main(int, char* []) {
  12.     vtkNew<vtkNamedColors> colors;
  13.    
  14.     vtkNew<vtkConeSource> cone;
  15.     cone->SetHeight(3.0);
  16.     cone->SetRadius(1.0);
  17.     cone->SetResolution(10);
  18.    
  19.     vtkNew<vtkPolyDataMapper> coneMapper;
  20.     coneMapper->SetInputConnection(cone->GetOutputPort());
  21.    
  22.     vtkNew<vtkActor> coneActor;
  23.     coneActor->SetMapper(coneMapper);
  24.    
  25.     vtkNew<vtkRenderer> ren1;
  26.     ren1->AddActor(coneActor);
  27.     ren1->SetBackground(
  28.     colors->GetColor3d("MidnightBlue").GetData());
  29.  
  30.     vtkNew<vtkRenderWindow> renWin;
  31.     renWin->AddRenderer(ren1);
  32.     renWin->SetSize(300, 300);
  33.  
  34.     vtkNew<vtkRenderWindowInteractor> interactor;
  35.     interactor->SetRenderWindow(renWin);
  36.  
  37.     interactor->Start();
  38.     for (auto i = 0; i < 360; ++i) {
  39.         // render the image
  40.         renWin->Render();
  41.         // rotate the active camera by one degree
  42.         ren1->GetActiveCamera()->Azimuth(1);
  43.     }
  44.     return EXIT_SUCCESS;
  45. }
Advertisement
RAW Paste Data Copied
Advertisement