[osg-users] TrackballManipulator versus Camera->setProjectionMatrix

Werner Modenbach Werner.Modenbach at texion.eu
Tue Jan 17 07:06:15 PST 2017


Hi OSG community,

my application needs "zoom keys". As a result the cursor position
gets centered in the window and depending on key the scene gets
zoomed.
I do this with this short method:

/**A zoom key was pressed (ESC,F1-F5)

*_xand_y is the cursor position in the window scaled to-1.0..+1.0

*/

voidCl_3Dview_osg::handleZoom(double_x,double_y,double_scale){

osg::MatrixoffsetMatrix=

osg::Matrix::scale(_scale,_scale,1.0)*

osg::Matrix::translate(-_scale*_x,_scale*_y,0.0);

view->getCamera()->setProjectionMatrix(view->getCamera()->getProjectionMatrix()*offsetMatrix);

}

The camera has a TrackballManipulator. After my offset is applied the 
home position of the manipulator is lost.
I guess I have to control the manipulator instead of the projection 
matrix of the camera.

Unfortunately I get stock because I don't manage to convert this 
accordingly.

I hope for some help here.

Many thanks for any hints.

- Werner -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20170117/56f737ca/attachment-0002.htm>


More information about the osg-users mailing list