[vtkusers] QVTKWidget camera problem

Gib Bogle g.bogle at auckland.ac.nz
Tue Nov 17 14:15:44 EST 2015


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151117/a537aa1f/attachment.html>


More information about the vtkusers mailing list