[vtkusers] HELP: vtkCamera::Elevation(90)increased through vtkRenderWindowInteractor causes erratic behaviour
Aroosha Laghaee
a.laghaee at sms.ed.ac.uk
Wed Apr 12 05:24:20 EDT 2006
Hi all,
I have written my own callback command which allows me to manipulate
the camera position in my vtkRenderWindowInteractor as I was interested
in separating manipulation of the camera's Elevation, Azimuth and Roll
(the standard mouse interaction on the Interactor can result in mixed
manipulation e.g. Elevation and Azimuth simultaneously).
I have created three view points of my object (3 renderers in 1
renderwindow): a) one from the side, b) one from the front Azimuth(90),
c) and one from above Elevation(90).
Here is the problem. When I change the Azimuth and Roll of the camera
via my callback everything is fine and I can move the camera
continuously in the correct direction as far as I like. But when it
comes to the Elevation, as soon as I try to increase it the camera in
the renderer which is showing the object from above (with its elevation
already at 90) gets stuck and one of the two objects which are sitting
next to each other starts jumping from right to the left of the other
object and back and this goes on until the other renderers also reach
the above view and start doing the same thing!
//the renderer definitions
m_SideRenderer = vtkRenderer::New();
m_SideRenderer->SetBackground(0.1,0.2,0.4);
m_SideRenderer->GetActiveCamera()->SetPosition(5,4,19);
m_SideRenderer->GetActiveCamera()->SetFocalPoint(5,4,0);
m_SideRenderer->GetActiveCamera()->SetClippingRange(10,30);
m_SideRenderer->SetViewport(0,0,0.7,1);
m_FrontRenderer = vtkRenderer::New();
m_FrontRenderer->SetBackground(0.2,0.3,0.5);
m_FrontRenderer->GetActiveCamera()->SetPosition(5,4,19);
m_FrontRenderer->GetActiveCamera()->SetFocalPoint(5,4,0);
m_FrontRenderer->GetActiveCamera()->SetClippingRange(10,30);
m_FrontRenderer->SetViewport(0.7,0,1,0.5);
m_FrontRenderer->GetActiveCamera()->Azimuth(90);
m_AboveRenderer = vtkRenderer::New();
m_AboveRenderer->SetBackground(0.3,0.4,0.6);
m_AboveRenderer->GetActiveCamera()->SetPosition(5,4,19);
m_AboveRenderer->GetActiveCamera()->SetFocalPoint(5,4,0);
m_AboveRenderer->GetActiveCamera()->SetClippingRange(10,30);
m_AboveRenderer->SetViewport(0.7,0.5,1,1);
m_AboveRenderer->GetActiveCamera()->Elevation(90);
//the portion of the call back dealing with elevation
if(lara->GetWindows().GetMode(Elevation)){
if(key=='.'){
printf("%c",key);
lara->GetWindows().GetRenderer(SideR).GetActiveCamera()->Elevation(5);
lara->GetWindows().GetRenderer(FrontR).GetActiveCamera()->Elevation(5);
lara->GetWindows().GetRenderer(AboveR).GetActiveCamera()->Elevation(5);
lara->Render();
}
if(key==','){
printf("%c",key);
lara->GetWindows().GetRenderer(SideR).GetActiveCamera()->Elevation(-5);
lara->GetWindows().GetRenderer(FrontR).GetActiveCamera()->Elevation(-5);
lara->GetWindows().GetRenderer(AboveR).GetActiveCamera()->Elevation(-5);
lara->Render();
}
}
Any ideas why this may be happening? Any help would be much appreciated.
Thank you,
Aroosha
School of Informatics, The University of Edinburgh,
James Clerk Maxwell Building, The King's Buildings,
Mayfield Road, Edinburgh EH9 3JZ
More information about the vtkusers
mailing list