HI Sonya,
Is your code calling viewer.run()? If so there is a code block in the
CompositeView::run() method that assigns a TrackballManipulator is none is
already assigned. This exists as a fallback in case there is no control
over the camera position.
The viewer.run() method is a convenience method that is only applicable for
straight forward usage, if you want to customize the behaviour then like
you want to do with the custom handling of the view and projection matrices
then your'd what to implement your own frame loop rather than rely upon
viewer.run(), within your own frame loop you can set all the values you
want. i.e.
viewer.realize();
while(!viewer.done())
{
// add code here to update the camera matrices.
viewer.frame();
}
Robert.
On 19 July 2014 11:06, Sonya Blade <[email protected]> wrote:
> Hi Robert,
>
> >What do you mean by "doesn't help"?
> >By default View's are constructed without a CameraManipulator so
> normally one would not need to do a view->setCameraManipulator(0);
>
> I'm directly modifying the compositeview example in OSG page and I only
> modify the "view two" code portion
> to discard the manipulator, as per your statement there is not even
> supposed to be manipulator at all. But
> in my case trackball is still operating even after I call "
> view->setCameraManipulator(NULL);" " view->setCameraManipulator(0);"
> consecutively and has drastical effects in ortho view.
>
> Code portion :
> // view two
> {
> osgViewer::View* view = new osgViewer::View;
> view->setName("View two");
> viewer.addView(view);
>
> view->setSceneData( rootnode );
> view->getCamera()->setName("Cam two");
> view->getCamera()->setViewport(new
> osg::Viewport(traits->width/2,0, traits->width/2, traits->height/2));
> view->getCamera()->setGraphicsContext(gc.get());
> view->getCamera()->setProjectionMatrixAsOrtho2D(-50,50,-50,50);
>
> view->setCameraManipulator(NULL);
> view->setCameraManipulator(0);
> view->addEventHandler(new PickHandler());
> }
>
> Regards,
>
> ------------------------------
> Date: Sat, 19 Jul 2014 10:44:23 +0100
> From: [email protected]
> To: [email protected]
> Subject: Re: [osg-users] Disabling cameramanipulator in CompositeViewer
>
>
> Hi Sonya,
>
>
> On 19 July 2014 09:16, Sonya Blade <[email protected]> wrote:
>
> Dear All,
> I need to switch off the camera manipulator in one of the views in
> composite viewer.
> Setting the view->setCameraManipulator(NULL); doesn't work in my case,
> setting camera
> manipulator to the 0 value doesn't help also.
>
>
> What do you mean by "doesn't help"?
>
> If there is no CameraManipulator assigned to a View then View's Camera's
> ViewMatrix will be left alone completely and will be up to your application
> to update directly. By default View's are constructed without a
> CameraManipulator so normally one would not need to do a
> view->setCameraManipulator(0);
>
>
>
> Furthermore, having calling the
> view->getCamera()->setProjectionMatrixAsOrtho2D(-newx,newx,-newy,newy);
> in each scrolling doesn't cause any wreak havoc or any performance
> penalty, right?
>
>
> It's very lightweight to update Camera's View and Projection matrix on
> each frame, there is essentially negligible cost.
>
> The only thing I'd add is that normally one doesn't implementing panning
> of view by updating the projection matrix, but by updating the view matrix.
>
> Robert.
>
>
>
>
> _______________________________________________ osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org