[vtkusers] vtkFollower as part of a vtkAssembly
franko
franko at mixzon.com
Fri Jan 31 13:29:02 EST 2014
Hi all,
I have some text labels that use vtkVectorText and vtkFollower. When I add
the followers to a vtkAssembly, the vtkFollower functionality no longer
works (the label no longer turned to face the camera). There were some very
old vtk-users threads (without solutions) that I saw using Google, but
couldn't find them in vtk-users mailing list archive (were they too old?
2001). I've tried reordering some of the vtk function calls, but I haven't
been able to get the vtkFollower functionality to work.
Here's my code (C++ ActiViz.Net):
// x-axis Title
// Create a vector text
vtkVectorText^ xVectorText = gcnew vtkVectorText();
xVectorText->SetText(xAxisTitle);
// Create a mapper
vtkPolyDataMapperDerived^ xMapper = gcnew vtkPolyDataMapperDerived();
xMapper->SetInputConnection(xVectorText->GetOutputPort());
// Create a subclass of vtkActor: a vtkFollower that always faces the
camera
vtkFollower^ xFollower = gcnew vtkFollower();
xFollower->SetMapper(xMapper);
xFollower->AddPosition(x1, y1, z1);
xFollower->SetScale(textScale);
xFollower->GetProperty()->SetColor(0, 0, 0);
//this->corViz->renderer->AddActor(xFollower);
//xFollower->SetCamera(this->corViz->renderer->GetActiveCamera());
// y-axis Title
// Create a vector text
vtkVectorText^ yVectorText = gcnew vtkVectorText();
yVectorText->SetText(yAxisTitle);
// Create a mapper
vtkPolyDataMapperDerived^ yMapper = gcnew vtkPolyDataMapperDerived();
yMapper->SetInputConnection(yVectorText->GetOutputPort());
// Create a subclass of vtkActor: a vtkFollower that always faces the
camera
vtkFollower^ yFollower = gcnew vtkFollower();
yFollower->SetMapper(yMapper);
yFollower->AddPosition(x2, y2, z2);
yFollower->SetScale(textScale);
yFollower->GetProperty()->SetColor(0, 0, 0);
yFollower->RotateZ(90.0);
// Combine axis titles in a vtkAssembly
vtkAssembly^ titleAssembly = gcnew vtkAssembly();
titleAssembly->AddPart(xFollower);
titleAssembly->AddPart(yFollower);
xFollower->SetCamera(this->corViz->renderer->GetActiveCamera());
yFollower->SetCamera(this->corViz->renderer->GetActiveCamera());
this->corViz->renderer->AddViewProp(titleAssembly);
Thanks,
~Frank
--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkFollower-as-part-of-a-vtkAssembly-tp5725733.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list