[osg-users] Can't update my projection matrix amnually

Robert Osfield robert.osfield at gmail.com
Thu Sep 15 08:49:14 PDT 2016


Hi Bruno,

There a few two many unknowns for us to know what is going on.  So we
can only guess.

Could it be that the OSG's default clamping of the near/far values to
fit with the bounds of the scene in the view frustum is what is
adjusting the projection matrix?

Try setting the ComputeFarMode to DO_NOT_COMPUTE_NEAR_FAR via

   viewer.getCamera()->setComputeFarMode(osg::CullSetting::DO_NOT_COMPUTE_NEAR_FAR);

Then see what happens.

Robert.

On 15 September 2016 at 16:18, Bruno Oliveira
<bruno.manata.oliveira at gmail.com> wrote:
> Hello,
>
>
> I am trying to set my view and projection camera matrix. I do this inside a
> custom camera manipulator code I am building.
>
> I set the camera view matrix as
>
> camera->setViewMatrix(getInverseMatrix());
>
> After this, since I am using a perspective projection matrix, I know I need
> to update my projection matrix. I try to do this with
>
> camera->setProjectionMatrixAsPerspective(30.f, aspectRatio, 0.5f, 500.f);
>
> This results in the following projection matrix,
>
>         2.69691 0 0 0
>
>         0 3.73205 0 0
>
>         0 0 -1.002 -1
>
>         0 0 -1.001 0
>
>
> However this is wrong, my matrix should be something similar to
>
>         2.69691 0 0 0
>
>         0 3.73205 0 0
>
>         0 0 -50 -1
>
>         0 0 -1.01309e+06 0
>
>
> What am I doing wrong? What else do I need to correctly compute the
> projection matrix?
>
> _______________________________________________
> 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