Hi Guo,

On Wed, Jan 12, 2011 at 7:04 AM, Guo Chow <[email protected]> wrote:
> I encounter a similar latency problem when I try to update a uniform using
> camera's view matrix in the uniform's callback. Since this uniform is needed
> to compute only once per frame, I decide to compute it on CPU before it's
> submitted to GPU.
>
> It seems that when the uniform's callback is called, the camera has not been
> updated yet, right?
>
> Currently I solve this problem by updating the uniform in a PreDrawCallback of
> the camera. But is this a graceful way to achieve it?

By default the osgViewer::Viewer/CompositeViewer runs the update
traversal before the camera matrices are set, this is done as camera
manipulators might be tracking movement of nodes in the scene which
are update in the update traversal so has to be run second.

One thing you could do is set the camera view matrix prior to the
updateTraversal() method is called, or do the update of your Uniforms
explicitly after the updateTraversal().

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to