[vtkusers] interactor in a main loop

Simon Drouin sdrouin at bic.mni.mcgill.ca
Wed Oct 6 09:51:33 EDT 2004


Hi Francesco,

It is not possible to do that unless you run your frame grabbing loop in 
a different thread (see vtkMultiThreader class).  If you use 
vtkVideoSource to grab frames, this is done for you. The Record method 
starts a different thread that grab frames continuously, so it doesn't 
interfere with your vtkInteractor loop.

The other problem is to tell the vtkInteractor loop to redisplay the 
content of its window when a new frame is available. You can solve that 
by using vtk with a gui toolkit, because some toolkits ( Qt and Mfc at 
least, I don't know for the others ) have threadsafe methods to post 
user defined events. In this case, you just need to watch 
vtkVideoSource's "Modified" event and when it is trigered, you post an 
event.

To vtk developers: is it in your plans to add some kind of threadsafe 
mechanism to standard vtkWindow to be able to post user-defined events  
that will be caught by the interactor? (maybe there is already something 
like that available, but I haven't found it)

Good luck Francesco.

Simon


francesco caruso wrote:

> Hello
>
> In my VTK application, there is a main loop in which
> frames are grabbed continuously.
>
> I'd like add an interactor, but when I do it the main loop stops
> because interactor is waiting for an event.
>
> How can I resolve this?
>
> Thanks in advance
> _______________________________________________
> 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://www.vtk.org/mailman/listinfo/vtkusers
>




More information about the vtkusers mailing list