VTK 中使用 vtkCommand::TimerEvent 回调函数不起作用

    
   
   // Initialize must be called prior to creating timer events.
    interactor->Initialize(); //在调用TimeEvent 时必须先初始化,否则不会调用Execute

    // 创建动画回调
    vtkSmartPointer<BallAnimation> animationCallback =
        vtkSmartPointer<BallAnimation>::New();
    animationCallback->SetActor(actor);
    animationCallback->SetRenderWindow(renderWindow);
// 设置定时器回调,每隔10毫秒更新一次  
    interactor->AddObserver(vtkCommand::TimerEvent, animationCallback);
    int timerId = interactor->CreateRepeatingTimer(10);

 

posted @ 2025-02-25 10:00  小丧美如画  阅读(72)  评论(0)    收藏  举报