Hi Mike,

> just a quick thought, but have a look at the code that sets up the
> "osg_" predefined GLSL uniforms.  that feature was added pre-OSG 1.0,
> and may have drifted during the viewer rework moving into OSG 2.x.
> dont know how many folks actually use those uniforms, and thus how
> much exercise they get.

Good suggestion, it's something I was wondering about. But it turns out 
that in OSG 2.2 (which is what we use here, but it's the same in SVN 
HEAD) the uniform is set by the SceneView during the cull traversal:

void SceneView::cull()
{
     // ...
     // update the active uniforms
     updateUniforms();
     // ...
}

void SceneView::updateUniforms()
{
     // ...

     if (_activeUniforms & VIEW_MATRIX_UNIFORM)
     {
         osg::Uniform* uniform =
             _localStateSet->getOrCreateUniform(
                 "osg_ViewMatrix",osg::Uniform::FLOAT_MAT4);
         uniform->set(getViewMatrix());
     }

     if (_activeUniforms & VIEW_MATRIX_INVERSE_UNIFORM)
     {
         osg::Uniform* uniform =
             _localStateSet->getOrCreateUniform(
                 "osg_ViewMatrixInverse",osg::Uniform::FLOAT_MAT4);
         uniform->set(osg::Matrix::inverse(getViewMatrix()));
     }

}

And executing that in the debugger, the code is run (it goes into the 
ifs) and it seems to set valid matrices. So that would seem to be OK.

Anything else you can spot which might be wrong in my code?

Thanks,

J-S
-- 
______________________________________________________
Jean-Sebastien Guay    [EMAIL PROTECTED]
                                http://www.cm-labs.com/
                         http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to