Paul Martz wrote:
Alternatively, it seems like I could use a cull callback to set the Uniform directly in osg::State. But there doesn't appear to be a public method for this. Am I missing something? This would certainly be the easiest and most efficient solution, and would work for any viewer usage, as long as there is a cull traversal per display (a pretty safe bet).
No help needed; Something quite like this is currently working for me. For the archives...
My cull callback class keeps a std::map< CullVisitor*, osg::StateSet* >, basically a StateSet per CullVisitor. In the StateSet, I have just the one Uniform I need to set. When my cull callback is executed, it gets the StateSet for the current CullVisitor (thread safe), updates the Uniform to the value appropriate for this display, and calls osgUtil::CullVisitor::pushStateSet(), then traverse(), then the corresponding popStateSet().
This allows me to have the same shader uniform variable set to different values depending on the CullVisitor, essentially, per display or per slave Camera. This approach should work regardless of the viewer used by the app.
If anyone has better ideas for how to do this, feel free to post. -Paul _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

