Moved old GL2Extensions::Get(..) usage across to new osg::State::get<GL2Extensions>() usage

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14567 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2014-12-04 16:28:32 +00:00
parent 66da1328f8
commit 6569f69de1
2 changed files with 12 additions and 9 deletions

View File

@ -34,8 +34,8 @@ VertexAttribDivisor::~VertexAttribDivisor()
void VertexAttribDivisor::apply(State& state) const
{
const GL2Extensions* extensions = GL2Extensions::Get(state.getContextID(), true);
if (extensions)
const GL2Extensions* extensions = state.get<GL2Extensions>();
if (extensions->glVertexAttribDivisor)
{
extensions->glVertexAttribDivisor( _index, _divisor );
}

View File

@ -45,9 +45,10 @@ void GLObjectsVisitor::apply(osg::Node& node)
bool programSetAfter = _renderInfo.getState()->getLastAppliedProgramObject()!=0;
if (programSetBefore && !programSetAfter)
{
osg::GL2Extensions* extensions = osg::GL2Extensions::Get(_renderInfo.getState()->getContextID(), true);
osg::State* state = _renderInfo.getState();
osg::GL2Extensions* extensions = state->get<osg::GL2Extensions>();
extensions->glUseProgram(0);
_renderInfo.getState()->setLastAppliedProgramObject(0);
state->setLastAppliedProgramObject(0);
_lastCompiledProgram = 0;
}
}
@ -66,9 +67,10 @@ void GLObjectsVisitor::apply(osg::Geode& node)
bool programSetAfter = _lastCompiledProgram.valid();
if (!programSetBefore && programSetAfter)
{
osg::GL2Extensions* extensions = osg::GL2Extensions::Get(_renderInfo.getState()->getContextID(), true);
osg::State* state = _renderInfo.getState();
osg::GL2Extensions* extensions = state->get<osg::GL2Extensions>();
extensions->glUseProgram(0);
_renderInfo.getState()->setLastAppliedProgramObject(0);
state->setLastAppliedProgramObject(0);
_lastCompiledProgram = 0;
}
}
@ -152,9 +154,10 @@ void GLObjectsVisitor::apply(osg::StateSet& stateset)
}
}
}
else if(_renderInfo.getState()->getLastAppliedProgramObject()){
osg::GL2Extensions* extensions = osg::GL2Extensions::Get(_renderInfo.getState()->getContextID(), true);
else if(_renderInfo.getState()->getLastAppliedProgramObject())
{
osg::State* state = _renderInfo.getState();
osg::GL2Extensions* extensions = state->get<osg::GL2Extensions>();
extensions->glUseProgram(0);
_renderInfo.getState()->setLastAppliedProgramObject(0);
}