Hello Pablo, Pablo Carneiro Elias wrote: > Hi all.. I have some trouble trying to map points from world to > screen... I've found a function within the camera matrix that should > give me the world to screen matrix... > > virtual void getWorldToScreen (Matrix &result, const Viewport& port); > > So I took my camera from SimpleSceneManager (which is a > PerspectiveCamera), and called the getWorldToScreen acquiring a matrix... > > then I tried to multiply a world point in order to get a screen point > like this: > > OSG::Matrix m; > > getCamera()->getWorldToScreen( m, *(_viewport.getCPtr()) ); // _viewport > is a ViewportPtr > > OSG::Vec3f result; > m.multMatrixVec( _start3d, result ); // _start3d is my 3d world point
OpenSG makes a distinction between points (locations in space) and vectors (basically directions), therefore you need to use Pnt3f and multMatrixPnt. The (3 element) vectors are translation invariant as they are considered to have w = 0 in homogeneous coordinates, while 3 element points are treated as if w = 1. See also Source/Base/Base/Base.dox \section BaseVectors for more information on the distinction between points and vectors. Hope it helps, Carsten ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users