From 6569f69de1aa136d44de5b342830fb61f172f857 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 4 Dec 2014 16:28:32 +0000 Subject: [PATCH] Moved old GL2Extensions::Get(..) usage across to new osg::State::get() usage git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14567 16af8721-9629-0410-8352-f15c8da7e697 --- src/osg/VertexAttribDivisor.cpp | 4 ++-- src/osgUtil/GLObjectsVisitor.cpp | 17 ++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) 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); }