[vtkusers] vtkCamera::SetPosition causes delayed rendering?

David Gobbi david.gobbi at gmail.com
Wed Jul 27 09:01:07 EDT 2011


On Wed, Jul 27, 2011 at 6:09 AM, David Doria <daviddoria at gmail.com> wrote:
>
> Thanks for pointing that out. After removing those calls, it works properly:
>   vtkCamera* camera = renderer->GetActiveCamera();
>   camera->SetPosition(450, 100, 100);
>   camera->SetFocalPoint(200, 0, 0);
>   camera->SetViewUp(0, 0, 1);
>
>   renderWindow->Render();
>   renderWindowInteractor->Start();
> However, if I have called renderWindow->Render(); before positioning the
> camera, even if I call Modified() on the renderer and renderWindow before
> the next Render() call, the output is still incorrect before an interaction
> occurs:
>   renderWindow->Render();
>   vtkCamera* camera = renderer->GetActiveCamera();
>   camera->SetPosition(450, 100, 100);
>   camera->SetFocalPoint(200, 0, 0);
>   camera->SetViewUp(0, 0, 1);
>   renderer->Modified();
>   renderWindow->Modified();
>   renderWindow->Render();
>   renderWindowInteractor->Start();
> Does this make sense?

Add renderer->ResetCameraClippingRange() after setting up the
camera.  The interactor calls this automatically for certain kinds of
interactions, but when you call Render() manually, you have to call
ResetCameraClippingRange() yourself when the object moves out
of the clipping range.  It is called automatically for the first render,
but not for subsequent renders.

 - David



More information about the vtkusers mailing list