[vtkusers] Using Timer and vtkRenderWindowInteractor

John Biddiscombe jbiddiscombe at skippingmouse.co.uk
Fri Jun 22 04:01:19 EDT 2001


I don't know of an example in the vtk distribution, but if you set a 
callback on one of the mouse events, you can implement your calcs directly 
in there. If the mouse is held down and the (internal) timer causes regular 
updates, then check to see if there's a callback you can set in there. The 
(one rather) mechanism for setting the callbacks is like so...

vtkCallbackCommand *cbc = new vtkCallbackCommand();
cbc->SetClientData(this);
cbc->SetCallback(YOUR CALLBACK FUNCION IN HERE);
obj->AddObserver(vtkCommand::AnyEvent OR PICK AN EVENT IN HERE, cbc);

and then a static function if a class member or just a normal one if not

void YourWin::CallBackFn(vtkObject *obj, unsigned long ID, void *self, void 
*data) {
     TBvtkToolwin *thisPtr = (TBvtkToolwin *)self;
     if (!thisPtr) return;
     DO STUFF HERE
}

JB


At 11:29 21/06/2001, Steve Boyd wrote:
>Hello,
>
>Could somebody please tell me where I can find an example of using Timer
>with vtkRenderWindowInteractor (or in general)?  I'm trying to
>understand how to use a timer to perform a calculation whenever an event
>occurs with the vtkRenderWindowInteractor.
>
>Sincerely,
>
>Steve
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers





More information about the vtkusers mailing list