[vtkusers] Getting text to follow the active camera.

Andrew Maclean a.maclean at acfr.usyd.edu.au
Wed Jan 17 20:10:29 EST 2001


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20010118/bfb50f57/attachment.htm>


More information about the vtkusers mailing list