[vtkusers] problem using vtkRenderWindowInteractor with data updates under Java

Jeff Lee jeff at cdnorthamerica.com
Tue Jan 7 17:49:18 EST 2003


Alan wrote:

> Thanks for the reply.  I understand the VTK/java threading dangers and 
> will be certain to update data only within the AWT thread.  But, I'm 
> still not clear on how to get a callback to respond in the absence of 
> any action from vtkRenderWindowInteractor.  The code in 
> TestVTKCanvas.java works off a Window Listener, but according to the 
> javadocs, this only sends events related to:
> opening/closing,
> activating/deactivating, and
> iconifying.deiconifying. 

There are two mechanisms at work - first, there is the user interaction 
(rotate, pan, etc...) which is handled by vtkRenderWindowInteractor. 
 Second, there are updates to the render window which occur when the 
upstream data changes or some parameter changes which causes a change in 
the display list (i.e. switch from wireframe to surface, etc...). 
 TestVTKCanvas.java demonstrates the first mechanism.   For the second, 
it is sufficient to modify the DataSet, and call Render() on the 
renderWindow which updates the pipeline and builds a new display list. 
 The reason I suggested you look at TestVTKCanvas was that it uses 
vtkPanel which allows you to use java's event loop.  If you go with a 
straight RenderWindow/Renderer/RenderWindowInteractor, then you will be 
stuck using the (X/win32) event loop.

>
>
> How would I get a callback to execute when the 
> vtkRenderWindowInteractor has no user input, but should still be 
> updating through the frames of a movie? 

So here's how I understand your problem.  A separate thread is somehow 
modifying your vtkDataSet.  You have already set up a pipeline and now 
just want to update the picture to reflect your most recent data.  In a 
nutshell, you would attach an observer to your thread which modifies the 
data.  This observer manually calls Render() on the renderWindow when 
notified which will then update the pipeline.  I could be way off - this 
is my interpretation of what you are trying to do.
-Jeff

>
>
> Thanks.,
>  --Alan
>
>





More information about the vtkusers mailing list