From 0af758716a9407f6a96a417c02f032388a6fea18 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 19 Jul 2006 20:56:24 +0000 Subject: [PATCH] For cases where the RenderBin has its own StateSet do a popAllStateSets() to ensure that the state is completely ready for the RenderBin's StateSet to be at the bottom. --- src/osgUtil/RenderBin.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/osgUtil/RenderBin.cpp b/src/osgUtil/RenderBin.cpp index 395d5a319..3973e6846 100644 --- a/src/osgUtil/RenderBin.cpp +++ b/src/osgUtil/RenderBin.cpp @@ -367,6 +367,11 @@ void RenderBin::drawImplementation(osg::State& state,RenderLeaf*& previous) if (_stateset.valid()) { + // first need to flush the stack + previous = 0; + state.popAllStateSets(); + + // now its safe to push RenderBin's StateSet as we now know its the root. state.pushStateSet(_stateset.get()); } @@ -417,16 +422,10 @@ void RenderBin::drawImplementation(osg::State& state,RenderLeaf*& previous) rbitr->second->draw(state,previous); } - // now reset the state so its back in its default state. - if (previous) - { - StateGraph::moveToRootStateGraph(state,previous->_parent); - previous = NULL; - } - if (_stateset.valid()) { - state.popStateSet(); + state.popAllStateSets(); + previous = 0; } //osg::notify(osg::NOTICE)<<"end RenderBin::drawImplementation "<