Hi Nitin,

There isn't really any proper way to convert between orthographic and
perspective projections, the two are essentially incompatible
projections.

You can try to make best mappings based the eye point, center of
rotation and your field of view in perspective, which makes the scene
look kinda like it's equivalent, but in the end it's not and you'll
likely ended up bitten eventually by trying to make the two more
alike.

Personally I'd recommend not trying to mix and match perspective and
orthographic projections, use each for their own strengths -
perspective for 3D views of the scene, and orthographic for plan/map
views, side views, etc.

Robert.

On Mon, May 31, 2010 at 4:22 PM, Nitin Rangari
<[email protected]> wrote:
> hi all,
>         i am trying to change Projection matrix from perspective to
> Orthographic
>         i am not finding proper way to do that..........
>         i am trying......
>
>          void GraphicsScene::makeOrtho()
>        {
>        osg::BoundingSphere bs = mRootNode->getBound();
>           double h= _gw->getTraits()->height;
>           double w= _gw->getTraits()->width;
>           double aspectratio=w/h;
>           double width = bs.radius()* 1.2;
>            double height = bs.radius()*1.2;
> i       f(width>height)
>       {
>           aspectratio=width/height;
>
>  getCamera()->setProjectionMatrixAsOrtho(-width*aspectratio,width,-height*aspectratio,height,1.0,10000.0);
>        }
>       else
>      {
>        aspectratio=height/width;
>
>   getCamera()->setProjectionMatrixAsOrtho(-width*aspectratio,width*aspectratio,-height,height,1.0,10000.0);
>        }
> }
> regards ,
> Nitin
> _______________________________________________
> 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

Reply via email to