[vtkusers] vtkFollower & MFC

Andrew Maclean a.maclean at acfr.usyd.edu.au
Thu Nov 2 20:54:05 EST 2000


How do you associate a vtkFollower object with a camera source in an MFC
application like Sample?

Clearly you cannot do something like this in the Document class:
            this->textActor->SetCamera(Renderer->GetActiveCamera());
            this->Props->AddItem(textActor);
Because the renderer Renderer is not visible.
So can you do this in the code where the view is generated?
i.e here in SampleViewDoc:

////////////////////////////////////////////////////////////////////////////
/
// CSampleView message handlers

void CSampleView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
            // TODO: Add your specialized code here and/or call the base
class
  vtkPropCollection *propc;
  vtkProp *prop;
  // TODO: Add your specialized code here and/or call the base class
  // first remove any old actors
  this->Renderer->GetProps()->RemoveAllItems();
  propc = this->GetDocument()->GetProps();
  propc->InitTraversal();
  while (prop = propc->GetNextProp())
    {
    this->Renderer->AddProp(prop);
    this->Renderer->ResetCamera();
    }

  this->vtkMFCRenderView::OnUpdate(pSender, lHint, pHint);
}

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


More information about the vtkusers mailing list