You have to set both the view matrix and the projection matrix of the camera.
The view matrix is the pose of the scene coordinate system in the camera coordinate system. Use void setViewMatrixAsLookAt (const osg::Vec3 &eye, const osg::Vec3 ¢er, const osg::Vec3 &up) and provide it with the position for the camera (eye) and your HUD object (center), and the vector that points in the up direction of the HUD (up), all un the scene coordinate system. The projection matrix sets the projection from 3d to 2d. Use void setProjectionMatrixAsPerspective (double fovy, double aspectRatio, double zNear, double zFar) arnaud houegbelo wrote: > Hello, > > I want to display a HUD without text but with perspective. > I used the code exemple osghud.cpp. Instead of creating > a geode with text I create a geode with a shape like sphere or > box. It woks fine. But I want to display it with a perspective. > When I create the osg::Camera instead of using ortho2D projection > I want to use perspective or frustnum projection. > > In osghud.cpp > > - camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1280,0,1024)); > > I tried to use a perspective like > > - camera->setProjectionMatrixAsPerspective(50.0, 1.0, 1.0, 1000.0); or > - > camera->setProjectionMatrix(osg::Matrix::perspective(50.0,aspectRatio,1.0,1000.0)); > > but my object disapear. > > It is possible to display an object like HUD (on the front of the scene) with > perspective? > > Best regards > Arnaud > > > > ____________________________________________________________________________________ > Looking for last minute shopping deals? > Find them fast with Yahoo! Search. > http://tools.search.yahoo.com/newsearch/category.php?category=shopping > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
begin:vcard fn:Per Rosengren n:Rosengren;Per org:Royal Institute of Technology (KTH);Computational Vision and Active Perception Laboratory adr:;;Teknikringen 14, room 621;Stockholm;;11428;Sweden email;internet:[EMAIL PROTECTED] title:Ph.D. student tel;work:+46 8 7906203 note:PGP keyID: 0xD40DD8E0 x-mozilla-html:FALSE url:http://www.csc.kth.se/~perrose/ version:2.1 end:vcard
signature.asc
Description: OpenPGP digital signature
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

