[osg-users] Converting model to screen coordinates
Helbig, Yuen
Yuen_Helbig at mentor.com
Wed Jul 2 15:27:28 PDT 2008
Hello,
I'm trying to convert from model coordinates to screen coordinates with
the following code:
// Compute the model to screen transformation matrix
osgUtil::SceneView* sv = m_sHandler->getSceneView();
osg::Matrix modelView = sv->getViewMatrix();
osg::Matrix projection = sv->getProjectionMatrix();
osg::Matrix window = sv->getViewport()->computeWindowMatrix();
osg::Matrix MVPW = modelView * projection * window;
// convert a point in model coordinates to screen coordinates
osg::Vec3 screenPoint = modelPoint * MVPW;
The resulting screen coordinate point is correct in the x-dimension, but
scaled down incorrectly in the y-dimension. The only point that is
correct is the center point of the model.
Am I missing a matrix somewhere? or does anyone have an alternate
method of doing this?
Yuen Helbig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080702/f74f73c9/attachment-0002.htm>
More information about the osg-users
mailing list