[vtkusers] Real Time Visualization by VTK??

pahsieh at usgs.gov pahsieh at usgs.gov
Wed Jun 7 13:50:30 EDT 2000


Yes, you can do "real time visualization" with vtk, but I think the
implementation is platform specific and involves multithreading.

In Win32/VC++, I set up a MFC project like the "sample" project
that is provided with the vtk source code. I add a "Start" and
a "Stop" button. When the "Start" button is clicked, a separate
thread is created to run the simulation. The code for this thread
looks something like

while (isSimulating)
{
  // advance one time step in the simulation--break when max time step is
reached
  // repaint the view (triggers renWin->Render())
}

The separate thread is needed so that the window is not frozen
during the animation. When the "Stop" button is clicked, the
variable isSimulation is set to 0 and the thread ends.

This allows you to stop the simulation, perform rotation,
zoom, etc, and then continue the simulation.

Hope this helps.
Paul Hsieh


> I've studied vtk by over 2 months by I still can't implement it
> into my simulation program.
> To be frank, vtk is the best visualiztion software that I can
> find in the web. The most important is that it's free!!
>
> But I want to raise the point that, can it carry out real time
> visualiztion of data??
> For my simulation program, it's something like that
> for (x=0;x<max_iteration;x++)
> {
>    do simulation
>    ....
> }
>
> If I want to use vtk for real time visualization of the data.
> Of course, I can insert some code into the for loop, modify the
> source and something "renWin->render()". But then, I can't
> control the vtk window, no zoom, no span, no dolly.........etc.
>
>
> If I use the vtkRenderWindowInteractor, then my program will
> enter the endless message loop after "ren->Start()" and can't
> back to my program for carrying out simulation.
>
> I have thought of writing two programs, one is the simulation
> program and another is a vtk program for visualization, the
> data wanted to be visualized is being written to a specific
> file and then read in by the vtk program. But the results of
> this approach is not satisfactory.
>
> Have anyone succeed in utilizing vtk for real time visulization
> or is it any other gun program that can be used for real time
visualization?






More information about the vtkusers mailing list