[vtkusers] vtkFollower + vtkAssembly
Olivier Nempont
nempont at tsi.enst.fr
Mon Oct 17 12:39:30 EDT 2005
Hi all,
In my application I want to place a vtkFollower in a vtkAssembly. But when I rotate the camera, the follower appear to rotate around a wrong point.
Below is the code i used to test that. Any idea about something I missed?
Thanks in advance!
Best regards,
Olivier
vtkVectorText text = new vtkVectorText();
text.SetText("test");
vtkPolyDataMapper textmapper = new vtkPolyDataMapper();
textmapper.SetInput(text.GetOutput());
vtkFollower textactor = new vtkFollower();
textactor.SetCamera(this.GetRenderer().GetActiveCamera());
textactor.SetMapper(textmapper);
textactor.GetProperty().SetColor(1,1,0);
textactor.SetPosition(0,0,0);
// this.GetRenderer().AddActor(textactor);
vtkSphereSource sphere = new vtkSphereSource();
sphere.SetRadius(1);
sphere.SetThetaResolution(10);
sphere.SetPhiResolution(10);
vtkPolyDataMapper spheremapper = new vtkPolyDataMapper();
spheremapper.SetInput(sphere.GetOutput());
vtkActor sphereActor = new vtkActor();
sphereActor.SetMapper(spheremapper);
sphereActor.GetProperty().SetColor(1,1,0);
sphereActor.SetPosition(-1,-0.5,5);
// this.GetRenderer().AddActor(sphereActor);
vtkAssembly obj = new vtkAssembly();
obj.AddPart(sphereActor);
obj.AddPart(textactor);
obj.SetOrigin(-2,0,0);
obj.AddPosition(-2,0,0);
this.GetRenderer().AddActor(obj);
this.GetRenderer().SetBackground(0, 0, 0.5);
this.GetRenderer().GetActiveCamera().SetPosition(0.5,0.5,20);
this.GetRenderer().GetActiveCamera().SetFocalPoint(0.5,0.5,0);
this.GetRenderer().GetActiveCamera().ParallelProjectionOff();
More information about the vtkusers
mailing list