[vtkusers] vtkCamera::SetPosition causes delayed rendering?
David Doria
daviddoria at gmail.com
Wed Jul 27 08:09:30 EDT 2011
On Tue, Jul 26, 2011 at 5:54 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> Hi David,
>
> You should never, ever call renderer->Render(). That method is only
> meant to be called by the vtkRenderWindow. The documentation says
> so quite clearly. By calling it you are probably causing some timestamps
> to be set (indicating that all actors in the renderer have rendered), but
> you
> aren't actually doing any rendering. Then, when you call
> renderWindow->Render() it sees that those timestamps have been updated
> and thinks that there is nothing to be done.
>
> Also it is a good idea to always set the ViewUp when setting the
> Position and FocalPoint. All three are needed in order to uniquely
> define the view transform.
>
> - David
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?
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110727/5a9f75e2/attachment.htm>
More information about the vtkusers
mailing list