[vtkusers] A problem about Multithread and VTK window (URGENT)

lian jiang jl_vtk at yahoo.com
Thu Mar 28 14:30:00 EST 2002


Hi, all: 
         I met a problem about VTK rendering window and multithread. 

         In my JAVA-VTK program, I have two button, A and B. In the method associated with A, there is an infinite loop, in which the actors are rendered 

from the first frame to last frame repeatedly in a rendering window. I set a globale variable "boolean jump=false". The infinite loop should exit by judging 

the value of "jump". In the method associated with button B, I set the variable as true.
        When I click A, the program will enter the infinite loop. I intend to exit the loop whenever I click the button B. But here is a problem. Once the 

program enters the dead loop, the GUI seems to be stucked and cann't respond to any user action. So the method of B can not set any global variable. 
         From the view of thread, it is easy to understand--because the two buttons are both in the GUI thread, the dead loop will surely block the GUI 
thread so that button B is disabled. 
         I tried to solve the problem by multithread. Although the loop can exit as I imaged,  there still are some problems.

         If I put the dead loop in a thread, the rendering window can not be refreshed. IF I put the method of B into a thread, the program runs still in 
the way descibed as above.        

         I don't know whether it is a common problem for all kinds of window refreshing.  I had studied multithread used in VTK for some time. As far as I 

know, VTK window will cause some problems in multithread because VTK calls opengl which is not safe for thread. But I am not sure whether the refreshing 

problem described above is caused by VTK or other reasons.  Is it a common problem for all kinds window refreshing?  Is there a way to solve this problem? 

         Thank you very much. 


BEST WISHES 

Lian 




---------------------------------
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20020328/fcbbeb2f/attachment.htm>


More information about the vtkusers mailing list