[vtkusers] vtkRenderWindowInteractor Timer callback

David Cole david.cole at kitware.com
Fri Feb 15 10:11:07 EST 2008


"// Initialize must be called prior to creating timer events."

This comment and "example / test" code for interactor timers can be found
in:
VTK/Rendering/Testing/Cxx/TestInteractorTimers.cxx

Also, you should use CreateRepeatingTimer or CreateOneShotTimer which are
newer APIs that replace the old single timer implementation accessed via
CreateTimer...


HTH,
David


On 2/8/08, Wesley Smith <wesley.hoke at gmail.com> wrote:
>
> Hi,
> I'm trying to figure out how to get the callback from a timer on a
> vtkRenderWindowInteractor.  I'm adding the interactor to the window
> with SetRenderWindow, and then calling:
>
> win->m_iren->CreateTimer(VTKI_TIMER_FIRST);
>
> This is on Windows by the way.  Then, I do
>
> class myCommand : public vtkCommand
>         {
>                 public:
>                         static myCommand *New()
>                         { return new myCommand; }
>
>                 virtual void Execute(vtkObject *caller, unsigned long,
> void* CBdata)
>                 {
>                         printf("Timer\n");
>                 }
>         };
>
> myCommand *cmd = myCommand::New();
> win->m_iren->AddObserver(vtkCommand::TimerEvent, cmd);
>
> And finally start everything up.  The problem is I'm not getting any
> any callbacks.  Clearly since this isn't working I'm not understanding
> how to do this.  What is the canonical method for betting a timer
> callback here?  Google and the VTK docs haven't turned anything up.
>
> thanks,
> wes
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080215/2a78d112/attachment.htm>


More information about the vtkusers mailing list