diff --git a/src/osg/VertexAttribDivisor.cpp b/src/osg/VertexAttribDivisor.cpp index ae76abea5..aa7951259 100644 --- a/src/osg/VertexAttribDivisor.cpp +++ b/src/osg/VertexAttribDivisor.cpp @@ -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(); + if (extensions->glVertexAttribDivisor) { extensions->glVertexAttribDivisor( _index, _divisor ); } diff --git a/src/osgUtil/GLObjectsVisitor.cpp b/src/osgUtil/GLObjectsVisitor.cpp index 02c3cca56..06970e5df 100644 --- a/src/osgUtil/GLObjectsVisitor.cpp +++ b/src/osgUtil/GLObjectsVisitor.cpp @@ -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(); 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(); 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(); extensions->glUseProgram(0); _renderInfo.getState()->setLastAppliedProgramObject(0); }