Hi all,
I want to know how to acquire the screen coordinates of a 3D object?
posi is a Vec3 containing the coordinates information in WCS. Then I tried:
osgViewer::Viewer viewer;
osg::Camera* cam = viewer.getCamera();
osg::Matrix viewMatrix = cam->getViewMatrix();
posi = posi*viewMatrix;
osg::Matrix projectionMatrix = cam->getProjectionMatrix();
posi = posi*projectionMatrix;
Staring here, the codes do not work anymore:
osg::Matrix windowMatrix = cam->getViewport()->computeWindowMatrix();
posi = posi*windowMatrix;
Here the posi is supposed to be the right screen coordinates but it just does
not work. Then how can I do with this?
Sorry for this simple post but I don't know very well about OpenGL and OSG, and
this question already occupied me two days.
So thanks in advance for anyone who gives me a reply!
...
Thank you!
Cheers,
Fan
------------------------
ohhhhhhhhhhhhhh newbie to OSG......................
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=52304#52304
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org