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

Bruno Oliveira bruno.manata.oliveira at gmail.com
Thu Sep 15 08:18:49 PDT 2016


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160915/20b6295c/attachment-0002.htm>


More information about the osg-users mailing list