Hi,
you could also have a look at osg's AutoTransform that does it all for you.
jp
Alan Wills wrote:
Alan wrote:
Hi,
I'm trying to get the screen coordinates of an object in my scene. My aim is to then to overlay the object in the scene with various things in a hud-style orthographic projection, e.g. to cover it with a texture. I am having difficulty in getting it to work. I thought something along the lines of finding
osg::Camera* cam = view->getCamera();
osg::Matrix win = camera->getViewport()->computeWindowMatrix();
osg::Matrix view = camera->getViewMatrix();
osg::Matrix proj = camera->getProjectionMatrix();
osg::Matrix model_mat = model_transform->getMatrix();
and then combining them, but this doesn't work.
Cheers,
Alan
To answer my own question:
osg::Vec3 world_location = ...
osg::Vec3 screen_coords = world_location * view * proj * window
does the job.
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=18257#18257
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard.
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their support.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org