[vtkusers] QVTKWidget camera problem
Gib Bogle
g.bogle at auckland.ac.nz
Tue Nov 17 15:16:01 EST 2015
Hi Dean,
I have tried ren->ResetCamera() after adding the actors, it displays OK but with the default scaling (i.e. camera position etc), just the same as if I do it initially and never change the camera.
Cheers
Gib
________________________________
From: DL I [inglis.dl at gmail.com]
Sent: Wednesday, 18 November 2015 9:10 a.m.
To: Gib Bogle
Cc: Ken Martin; vtkusers at vtk.org
Subject: Re: [vtkusers] QVTKWidget camera problem
Hi Gib,
maybe try removing
iren->Initialize();
and calling
ren->ResetCamera();
after you have added the actor(s)?
- Dean
On Tue, Nov 17, 2015 at 3:03 PM, Gib Bogle <g.bogle at auckland.ac.nz<mailto:g.bogle at auckland.ac.nz>> wrote:
Thanks for the suggestions, Ken. Neither had any effect, unfortunately.
Cheers
Gib
________________________________
From: Ken Martin [ken.martin at kitware.com<mailto:ken.martin at kitware.com>]
Sent: Wednesday, 18 November 2015 8:28 a.m.
To: Gib Bogle
Cc: vtkusers at vtk.org<mailto:vtkusers at vtk.org>
Subject: Re: [vtkusers] QVTKWidget camera problem
renderer->ResetCameraClippingRange() maybe? That and camera->OrthogonalizeViewUp() are the two common things to try when manual camera changes do not work.
Thanks
Ken
On Tue, Nov 17, 2015 at 2:15 PM, Gib Bogle <g.bogle at auckland.ac.nz<mailto:g.bogle at auckland.ac.nz>> wrote:
I have now established conclusively that adjusting the camera setup with SetPosition and SetFocalPoint stops the scene from being displayed, while any movement of the mouse with a button down restores display.
qvtkWidget = new QVTKWidget(page,QFlag(0));
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(qvtkWidget);
page_VTK->setLayout(layout);
ren = vtkRenderer::New();
renWin = qvtkWidget->GetRenderWindow();
renWin->AddRenderer(ren);
ren->ResetCamera();
iren = qvtkWidget->GetInteractor();
vtkSmartPointer<MouseInteractorStyle4> style = vtkSmartPointer<MouseInteractorStyle4>::New();
iren->SetInteractorStyle( style );
iren->Initialize();
ren->GetActiveCamera()->SetPosition(0, 0, 0);
ren->GetActiveCamera()->SetFocalPoint(x0, x0, x0);
If I remove the last two lines the scene is centred OK, but not at the scale I want. I can play with Zoom(), but SetFocalPoint(x0,x0,x0) ensures that I get the desired scaling directly.
Is this the expected behaviour? I'm wondering if it is the result of using the QVTKWidget "default" camera instead of creating a new one to use (please excuse deficiencies in my understanding). Is Zoom() the only way to achieve what I want?
_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Search the list archives at: http://markmail.org/search/?q=vtkusers
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
--
Ken Martin PhD
Chairman & CFO
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065
518 371 3971
This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message. Thank you.
_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Search the list archives at: http://markmail.org/search/?q=vtkusers
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151117/3bd11842/attachment.html>
More information about the vtkusers
mailing list