[osg-users] Properties in osg::Camera and values of gl_ModelViewMatrix seem out of sync.

Robert Osfield robert.osfield at gmail.com
Fri Oct 16 00:58:36 PDT 2015


Hi Roy,

On 15 October 2015 at 19:27, Roy Arents <osgforum at tevs.eu> wrote:

> Hi,
>
> Is there any update on this issue?
> I seem the run into the same. I'm using osg 3.2.1 if this is solved in a
> new version I could migrate to a more recent version, but hopefully someone
> can indicate which version does not have this problem.
>

Just had a look at your example code, looks to me like the update callback
that you are updating the uniforms with is being called before the the
Camera's view's matrix is being updating by the viewer.  Have a  look at
the implementation of Viewer::updateTraversal() in
OpenSceneGraph/src/osgViewer/Viewer.cpp, you'll see that the update
traversal is done then the CamaraManipulator is queried.

You will probably then ask "why" it's done in this order, well
CameraManipulator's can use the position of nodes to determine the camera
position, something that isn't set in stone till after the update traversal.

So how to untangle this?  Well you could just override the
updateTraversal() to do what you want OR you can doing your own frame()
implementation calling the updates between the updateTraversal() and
renderingTraversals() OR just rewrite your code to use the osg_ViewMatrix
and osg_ViewMatrixInverse uniforms that it provides.

Robert.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20151016/1a8fb228/attachment-0002.htm>


More information about the osg-users mailing list