[vtkusers] Vtk interactor

R K Shyam Prakash ramakrishna.prakash at quest-global.com
Thu Jun 10 10:33:02 EDT 2004


Tom,
 
> I was assuming the IsAnimating() call was to detect if 
> rendering was underway, in which case you would want to do nothing..
> 

Actually I am checking if the animation is under way here. But,

void CustomInteractor::OnLButtonDown(HWND wnd,UINT nFlags,int X,int Y){
	if(model->IsAnimating()){
		return;
	}

	
this->vtkWin32RenderWindowInteractor::OnLButtonDown(wnd,nFlags,X,Y);
}

If the method returns while the animation is under way, after that the
interactor never responds to any calls. I even tried simply calling
Enable() and then Disable() on the interactor and the interactor goes
dead. But mind you I am calling these methods from new thread. I assume
that this could be creating the problems.

Thanks
Shyam


> 
> -tom
> 
>  <000501c44ee1$eeb00e20$8c0aa8c0 at questtw.questglobal.com>"R K 
> Shyam Prakash" wr
> ites:
> >Hello Tom/Users,
> >		I tried to lock using a vtkMutexLock just before calling
> >Render() in the animation thread. But it did not work. The 
> application 
> >still crashes when the user clicks on the render window when the 
> >animation is in progress. I am not sure if what I did was 
> right. If you 
> >have a sample code, that will be of great help ?
> >
> >Thanks
> >Shyam
> >
> >
> >> -----Original Message-----
> >> From: vtkusers-bounces at vtk.org
> >> [mailto:vtkusers-bounces at vtk.org] On Behalf Of tom fogal
> >> Sent: Wednesday, June 09, 2004 11:42 PM
> >> To: R K Shyam Prakash
> >> Cc: vtkusers at vtk.org
> >> Subject: Re: [vtkusers] Vtk interactor
> >> 
> >> 
> >> Use a mutex.
> >> Threading libraries usually provide a 'mutex_lock()' function
> >> that will block until the mutex is acquired.
> >> 
> >> HTH,
> >> 
> >> -tom
> >> 
> >>  <005a01c44e4c$6097f930$8c0aa8c0 at questtw.questglobal.com>"R K
> >> Shyam Prakash" writes:
> >> >Hello,
> >> >
> >> >	I am using vtk4.2.2 with MFC (VC++6.0). I am trying to animate
> >> >rotation of a cylinder in a separate thread. However, if 
> any mouse 
> >> >events are fired during animation, program crashes as two 
> >> threads are
> >> >accessing simultaneously. So I would like to block my
> >> interactor until
> >> >the animation is complete. How can I achieve this. I tried
> >> overriding
> >> >vtkWin32RenderWindowInteractor. Following is the code.
> >> >
> >> >void CustomInteractor::OnLButtonDown(HWND wnd,UINT
> >> nFlags,int X,int Y){
> >> >	if(model->IsAnimating()){
> >> >		return;
> >> >	}
> >> >
> >> >	
> >> 
> >this->vtkWin32RenderWindowInteractor::OnLButtonDown(wnd,nFlags,X,Y);
> >> >}
> >> >
> >> >Initially it works fine. When the animation starts, it 
> successfully
> >> >blocks the mouse events. However, even after animation is 
> completed
> >> >(model->IsAnimating() returns false), the interactor (super 
> >> class) does
> >> >not process the mouse events. Am I doing some thing wrong
> >> here? Please
> >> >suggest.
> >> >
> >> >Thanks
> >> >Shyam
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: 
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list