[vtkusers] Getting text to follow the active camera.

Dimitris Agrafiotis d.agrafiotis at bristol.ac.uk
Thu Jan 18 05:59:08 EST 2001


Have a look at the vtkFollower class.
Dimitris

On Thu, 18 Jan 2001 12:10:29 +1100 Andrew Maclean 
<a.maclean at acfr.usyd.edu.au> wrote:

> How do I get the text to follow the active camera? I am using the Doc/View
> paradigm in the vtk/MFC example where you fill a vtkPropCollection with
> actors, then add them to your "picture view" during OnUpdate().
> 
> In the document class I do this:
>             //-------- The pipeline for text
>             // Source
>             vText->SetText(txt);
>             // Filters
> 
>             // Mapper
>             textMapper->SetInput(vText->GetOutput());
> 
>             // Actor
>             textActor->SetMapper(textMapper);
>             textActor->SetScale(1,1,1);
>             textActor->AddPosition(0,-0.1,-0.1);
>             textActor->GetProperty()->SetDiffuseColor(0.2784, 1.0000,
> 0.3882);
>             textActor->GetProperty()->SetSpecularColor(0.2784, 1.0000,
> 0.3882);
>             textActor->GetProperty()->SetSpecular(0.4);
>             textActor->GetProperty()->SetSpecularPower(50);
>             textActor->GetProperty()->SetInterpolationToGouraud();
>             textActor->GetProperty()->SetOpacity(0.75);
> //          textActor->SetCamera(Renderer->GetActiveCamera());
> 
> Clearly the last line will not work because the Renderer is in the view
> class. So how do I get the active camera for the text actor?
> Is there some way of doing this in the view class in particular OnUpdate(),
> where you are adding the actors to the renderer as done in the following
> code snippet.
>                while (prop = propc->GetNextProp())
>                {
>                                this->Renderer->AddProp(prop);
>                }
>                this->Renderer->ResetCamera();
> 
> 
> If you have an answer, many thanks in advance!!
> 
> 
> Andrew
> 






More information about the vtkusers mailing list