[vtkusers] VTK and multi-touch input processed in other thread

Tijmen Klein T.R.Klein at student.rug.nl
Thu May 26 09:31:27 EDT 2011


Dear fellow VTK users,

I'm working on a project where I will use VTK to visualize a dataset and use
a multitouch device to specify certain interactions. The touch events are
processed using TUIO, which has a nice library to process its events.
However, this library launches a new thread to watch for the messages (that
come in over UDP), and this basically disables me to update/redraw VTK from
that thread.
My question is the thus the following: what is the best way to send events
from another thread to VTK, bearing in mind that this should happen quickly
(as it is used for interaction).

The current implementation that I use for for this is quite simple (and
ugly). Whenever some TUIO events are processed I put some information about
this in a global variable, then the TUIO thread will generate a keystroke
that will wake op the custom VTK interactorstyle, the interactorstyle will
then read the global variable and do something with it, afterwards the
interactorstyle will call a render() on the interactor. While this does
work, it feels really hacky. Could someone propose a better method?

Cheers,
Tijmen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110526/45dcd85b/attachment.htm>


More information about the vtkusers mailing list