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 -
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to