[vtkusers] How to change the vtkRenderWindowInteractor setting??

leung fung man german_leung at hotmail.com
Tue Feb 27 06:55:41 EST 2001


Dear all vtk user:
I try to update the actor in the rendering window by the encoder signal!  
But I facing the problems like this:
I need to press 'q' or 'e' to carried out the looping operation!  Can I 
change the void vtkRenderWindowInteractor::SetUserMethod (  void(* f)(void 
*),
void * arg )
by using timer in C++?
My code like this:-------
void main()

{

int x,y,z,i,a=0,b=10,c=0;
for ( i = 1; i <= 20; i++)
	{
//scanf("%f %f %f",&x,&y,&z);

	vtkRenderWindow *renWin;
	vtkRenderer *ren1;
	vtkRenderWindowInteractor *iren;
	vtkSTLReader *hip;
	vtkPolyDataMapper *joinMapper;
	vtkActor *joinActor;
	vtkSTLReader *cut;
	vtkPolyDataMapper *cutterMapper;
	vtkActor *cutterActor;


	//input the hipjoint
	hip = vtkSTLReader::New();

	hip->SetFileName("ballJoint60.stl");
	//map to graphics lib

	joinMapper = vtkPolyDataMapper::New();

	joinMapper -> SetInput (hip->GetOutput());

	//input cutter
	cut = vtkSTLReader::New();
	cut->SetFileName("cutter3.stl");
	cutterMapper = vtkPolyDataMapper::New();
	cutterMapper -> SetInput (cut->GetOutput());

	//actor coordniates geometry
	joinActor = vtkActor::New();
	cutterActor = vtkActor::New();

joinActor->SetPosition(0, 0, 0);
joinActor->RotateX(-90);
joinActor->SetMapper(joinMapper);

//printf("\please enter x y z \n");
cout << "please enter x, y, z" <<"\n";
cin >>x>>y>>z;
a=x+a;
b=y+b;
c=z+c;
cutterActor->SetPosition(a, b ,c);
//cutterActor->SetPosition(0, 10 ,0);
cutterActor->RotateX(-90);
cutterActor->SetMapper(cutterMapper);

//create a window;

	renWin = vtkRenderWindow::New();
	ren1 = vtkRenderer::New();
	renWin->AddRenderer(ren1);
	iren=vtkRenderWindowInteractor::New();
	iren->SetRenderWindow(renWin);

	ren1->AddActor(joinActor);
	ren1->AddActor(cutterActor);
	ren1->SetBackground(0.1,0.2,0.4);

	renWin->SetSize(500,500);

	renWin->Render();
	iren->Start();

	//return 0;
// Clean up
  ren1->Delete();
  renWin->Delete();

  //cube->Delete();
  //points->Delete();
  //polys->Delete();
  //scalars->Delete();
  joinMapper->Delete();
  joinActor->Delete();
  //camera->Delete();
iren->Delete();
cutterActor->Delete();
cutterMapper->Delete();
	}


}
--------------------------------
I want to terminate the render windows by using the timer, say 0.5s!

Thank you for any advise!!


Best regards,
German Leung

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.





More information about the vtkusers mailing list