[vtkusers] update vtkTextActor

camarli niccolo.camarlinghi at pi.infn.it
Mon Feb 8 09:15:05 EST 2010


Dear vtk users,


Forgive my newbie question, I'm trying to render a simple object e.g. a
cone, and to visualize ,using vtkCornerAnnotation a piece of text
representing the camera orientation i.e. roll,Elevation,azimuth etc.. 
My problem is that when i rotate the camera,using the mouse, the text is
not updated and i cannot figure out how to "force" this update. 
Since I'm new to vtk I'd like to know if I'm using the wrong class for
this task or if there is a simple way to update the text. 
I attach a little peace of code to explain what I'm doing.



Many Thanks 

Niccolo' Camarlinghi
// float 2 string
std::string Convert (float number)
{
std::ostringstream buff;
buff<<number;
return buff.str();
}

...
// set the camera initial position
vtkCamera* cam1 = (ren1->GetActiveCamera());
cam1->Elevation(this->Elevation);
cam1->Azimuth(this->Azimuth);
cam1->Roll(this->Roll);
cam1->SetDistance(this->Distance);
cam1->OrthogonalizeViewUp();



// show angle camera
vtkCornerAnnotation *TextActor=vtkCornerAnnotation::New();
TextActor->SetText(1,Convert(ren1->GetActiveCamera()->GetOrientation()[0]).c_str());
ren1->AddActor(TextActor);
renWin->Render();
// begin mouse interaction
iren->Start();
...





More information about the vtkusers mailing list