[osg-users] osgViewerMFC Resize Issue

Donald Cipperly osgcipp at gmail.com
Wed Oct 24 13:22:36 PDT 2007


I found a small error in calculating the x mouse location after resizing the
render window in the osgViewerMFC example.  I've traced this back in the
debugger to osgViewer::Viewer::eventTraversal().  Line 550 in this file has
the correct value:

float x = event->getX();

However, the calculations in lines 599-607 produce an incorrect value for x:

osg::Viewport* viewport = getCameraWithFocus()->getViewport();
osg::Matrix localCameraVPW = getCameraWithFocus()->getViewMatrix() *
getCameraWithFocus()->getProjectionMatrix();
if (viewport) localCameraVPW *= viewport->computeWindowMatrix();

osg::Matrix matrix( osg::Matrix::inverse(localCameraVPW) * masterCameraVPW
);

osg::Vec3d new_coord = osg::Vec3d(x,y,0.0) * matrix;

x = new_coord.x();


The viewport is correct, so it looks like the view matrix or projection
matrix aren't being refreshed properly after a resize.  The y value is
always correct :/

Not sure where to look from here...any ideas?

Thx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071024/04696e68/attachment-0002.htm>


More information about the osg-users mailing list