diff --git a/examples/osgshaderpipeline/osgshaderpipeline.cpp b/examples/osgshaderpipeline/osgshaderpipeline.cpp index 7857cc7f1..b4db0a00f 100644 --- a/examples/osgshaderpipeline/osgshaderpipeline.cpp +++ b/examples/osgshaderpipeline/osgshaderpipeline.cpp @@ -228,20 +228,27 @@ bool setUpStateSet(osg::ArgumentParser& arguments, osg::StateSet* stateset) struct RealizeOperation : public osg::GraphicsOperation { - RealizeOperation(osg::StateSet* stateset) : - osg::GraphicsOperation("RealizeOperation",false), - _stateset(stateset) + RealizeOperation(osg::ArgumentParser& arguments, osg::StateSet* stateset) : + osg::GraphicsOperation("RealizeOperation",false) { + _stateset = stateset; + _useModelViewAndProjectionUniforms = arguments.read("--mv"); + _useVertexAttributeAliasing = arguments.read("--va"); } virtual void operator () (osg::GraphicsContext* gc) { OSG_NOTICE<getState()->pushStateSet(_stateset.get()); - gc->getState()->setRootStateSet(_stateset.get()); + + gc->getState()->setUseModelViewAndProjectionUniforms(_useModelViewAndProjectionUniforms); + gc->getState()->setUseVertexAttributeAliasing(_useVertexAttributeAliasing); + + if (_stateset.valid()) gc->getState()->setRootStateSet(_stateset.get()); } osg::ref_ptr _stateset; + bool _useModelViewAndProjectionUniforms; + bool _useVertexAttributeAliasing; }; int main(int argc, char** argv) @@ -263,12 +270,12 @@ int main(int argc, char** argv) // set up the topmost StateSet with the shader pipeline settings. setUpStateSet(arguments, stateset); - if (arguments.read("--state")) - { - OSG_NOTICE<<"Assigning RealizerOperation"<setStateSet(stateset.get()); }