[vtkusers] Using Java Threads in VTK

Shyam Prakash ramakrishna.prakash at quest-global.com
Mon Dec 8 23:34:00 EST 2003


Saha,
            You can update the data in worker thread and render the view
in event dispatch thread. If you are handling the threads directly, then
 
new Thread(new Runnable(){
            public void run(){
                        //do the data update
 
                        SwingUtilities.invokeLater(new Runnable(){
                                    public void run(){
Render();
}
});
}
 
}).start();
 
else you can use easy thread solutions like SwingWorker or Foxtrot.
 
--Shyam
 
-----Original Message-----
From: vtkusers-admin at vtk.org [mailto:vtkusers-admin at vtk.org] On Behalf
Of Sunayana Saha
Sent: Tuesday, December 09, 2003 3:46 AM
To: vtkusers at vtk.org
Subject: [vtkusers] Using Java Threads in VTK
 
Hi,
 
I am trying to create a 3D animation tool using VTK in Java. I basically
want to iterate through different set of 3D points continuously, until
the user decides to stop. If I do this using an infinite 'while' loop,
then I lose control over the program and the user can no longer stop the
animation unless he totally terminates the program.
 
I am thus trying to use a Java Thread to implement the above
functionality. I change the points in the 'run()' method of the Thread
and then try to render the VTK window. As soon as I do this, I get lots
of C++-side errors in a pop-up window. I read a previous post in VTK's
mailing list and that says that using Render in the Thread construct
method causes this problem. When I comment out the Render statement, I
do not get the C++ side errors, but the window is no longer updated to
reflect the new set of points.
 
I will sincerely appreciate if someone could give me suggestions on how
to work around this problem.
 
Thanks alot,
Saha

 
  _____  

Do you Yahoo!?
New
<http://pa.yahoo.com/*http:/us.rd.yahoo.com/evt=21260/*http:/photos.yaho
o.com>  Yahoo! Photos - easier uploading and sharing
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20031209/587700c0/attachment.htm>


More information about the vtkusers mailing list