[vtkusers] bug in vtkInteractorStyleFlight ?

Jean-Dominique Barnichon jeando.barnichon at free.fr
Fri May 30 17:52:43 EDT 2003


Hi,

I am developing a soft with VC++ 6.0 and vtk4.0, in which I want the user to
be able to choose between several interaction modes (joystick, trackball,
flight).

Everything works fine in most cases, i.e. the user is able to change the
interaction mode. However, from time to time, the program crashes on such a
change without any explicit message.
The "strange" thing is that when a crash occurs, it is always on the
selection of the flight mode, never for the other modes. As the code
responsible (see herebelow) of changing the interaction mode looks pretty
much the same in the 3 cases, I am wondering if this could be a problem/bug
in vtkInteractorStyleFlight.

Does anybody has already experienced such a problem, or has any idea of
where it could come from?

Thanks,
Jean-Do

When the user changes the interaction mode, the current mode is deleted, a
new one is created and assigned to the interactor.

// Joystick interaction mode
void CMyView::OnJoystick()
{	if (this->Interactor) {
this->Interactor->GetInteractorStyle()->Delete(); }
	vtkInteractorStyleTrackball* JoystickStyle =
vtkInteractorStyleTrackball::New();
	JoystickStyle->SetTrackballModeToJoystick();
	this->Interactor->SetInteractorStyle(JoystickStyle);
}

// Flight interaction mode
void CMyView::OnPilot()
{	if (this->Interactor) {
this->Interactor->GetInteractorStyle()->Delete(); }
	vtkInteractorStyleFlight* FlightStyle = vtkInteractorStyleFlight::New();
	double data[3]={0,0,1};
	FlightStyle->SetFixedUpVector(data);
	FlightStyle->FixUpVectorOn();
	this->Interactor->SetInteractorStyle(FlightStyle);
}

// Trackball interaction mode
void CMyView::OnTrackball()
{	if (this->Interactor) {
this->Interactor->GetInteractorStyle()->Delete(); }
	vtkInteractorStyleTrackball* TrackballStyle =
vtkInteractorStyleTrackball::New();
	TrackballStyle->SetTrackballModeToTrackball();
	this->Interactor->SetInteractorStyle(TrackballStyle);
}






More information about the vtkusers mailing list