Update point in real time

(osamax) #1

Hi everyone,

I’m very new to VTK. I’ve found it to be quite complicated but have been familiarizing myself by playing with the tutorial examples (in C++).

The task I’m working on is to have a single point that changes positions in real time. I have a simple VTK program that draws the initial point.

I have a separate C++ program that I wrote which continuously updates the position I want the point to move to (x and y coordinates). These values are obtained from a mouse sensor. I use an infinite while loop to continuously get the values I need.

From what I’ve been able to see, the only way I can update the position of the point after rendering is to use a callback function. I am using a timer callback so I can repeatedly enter the function to update the point position.

My issue is that I am not sure how to link the two programs. How can I initialize and render my point and at the same time also read coordinates from the mouse sensor?

I would appreciate any help and can gladly offer more details if required.

Thanks!