[osg-users] camera standard frustum

Robert Osfield robert.osfield at gmail.com
Mon Mar 9 05:04:12 PDT 2009

Hi Marttin,

osg::Camera always has a projection and view matrix, you can't
disable/remove them.

osg::Camera stores the projection matrix as a 4x4 matrix, which you
can get using Camera::getProjectionMatrix().

When you set the projection matrix using
setProjectionMatrixAsFrustum(...) it does the equivalent of glFrustum,
setting the 4x4 matrix appropriately.  The left, right etc parameters
aren't ever stored, it's only the 4x4 matrix.  When you do
Camera::getProjectMatrixAsFrusutm(..)  it recovers the left, right etc
values from the 4x4 matrix.

As to what might be wrong in your case, we'll it's very likely that
the OSG itself is doing anything wrong as these methods are commonly
used and tested, more likely is that you own expectation are
mismismatched with what is actually happening.  You don't say anything
about the wider context of your camera use, or why you think the
values are correct so I can't speculate what the actual problems might


On Mon, Mar 9, 2009 at 11:47 AM, Martin <grosser.martin at gmx.de> wrote:
> Hello,
> when i create a camera:
> osg::ref_ptr< osg::Camera> cam = new osg::Camera();
> and I want to get the frustum parameters:
> cam->getProjectionMatrixAsFrustum(left,right,bottom,top,znear,zfar);
> I dont't get the parameters. It seems that the camera hasn't a projection matrix. Where is the projection matrix define in this situation? When I set my own projection matrix with setProjectionMatrix( ... ) it works fine.
> Cheers,
> Martin
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=8087#8087
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list