[osg-users] Setting 2D Camera in scene

2010-05-06 Thread Nitin Rangari
hi All,

I am trying to set 2D Camera in scene

 i have write code for that

 pScene-getCamera()-setProjectionMatrixAsOrtho2D(-1,1,-1,1);

  but its coming 3D.

regards,
Nitin
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Setting 2D Camera in scene

2010-05-06 Thread Aitor Ardanza
Hi Nitin,

Try with this code:


Code:
 // create a camera to set up the projection and model view matrices, and the 
subgraph to drawn in the HUD
osg::Camera* camera = new osg::Camera;
// set the projection matrix
camera-setProjectionMatrix(osg::Matrix::ortho2D(0,width,0,height));
// set the view matrix
camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
camera-setViewMatrix(osg::Matrix::identity());
// only clear the depth buffer
camera-setClearMask(GL_DEPTH_BUFFER_BIT);
// draw subgraph after main camera view.
camera-setRenderOrder(osg::Camera::POST_RENDER);
// we don't want the camera to grab event focus from the viewers main 
camera(s).
camera-setAllowEventFocus(false);
camera-addChild(mGeode);



Cheers,
Aitor

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=27607#27607





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org