I've used this technique, also using an osg:BoundingBox(-1,-1,-1,1,1,1) check (before applying the windowmatrix) to see if the point is in view.
Which leads me to ask, if you have multiple slave cameras (for ex: 4 cams, each viewport rendering 25% of the scene left-to-right), how can you best determine which camera to use for the projection technique below? (i.e. what camera is the point in view?), or do you need to test all of them to find it? Bob. ----------------------------------------------------------- Robert Osfield wrote: > > Hi Michele, > > All the component parts required are there in osg::Camera and > osg::Matrix and can be mixed and matched depending upon your needs. > > To go from object coords to window you do: > > osg::Matrix MVPW = modelmatrix * > camera->getViewMatrix() * > camera->getProjectionMatrix() * > > camera->getViewport()->computeWindowMatrix(); > > osg::Vec window = object * MVPW; > > Robert. > > On Mon, Apr 21, 2008 at 5:19 PM, Michele Bosi <[EMAIL PROTECTED]> wrote: > > Hello, > > I need to project the mouse coordinates in world coordinates given a > > Camera*, how can I implement this? I expected some "project"/"unproject" > > method similar to gluProject/Unproject in the Camera class or in the Viewer > > or in Matrix but couldn't find anything. Can anyone point me in the right > > direction before I start cut-and-pasting the sourcecode from MESA's > > gluProject()? :) > > > > Thanks, > > Michele > > > > _______________________________________________ > > osg-users mailing list > > [email protected] > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Robert E. Balfour, Ph.D. Exec. V.P. & CTO, BALFOUR Technologies LLC 960 South Broadway, Suite 108, Hicksville NY 11801 Phone: (516)513-0030 Fax: (516)513-0027 email: [EMAIL PROTECTED] _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

