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

