Ported GL2Extentions across to using the new GL extensions approach - cutting code count by 3000 lines!

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14566 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-12-04 16:22:31 +00:00
parent f8d53b7c8d
commit 66da1328f8
9 changed files with 422 additions and 3375 deletions

View File

@@ -67,7 +67,7 @@ void Program::flushDeletedGlPrograms(unsigned int contextID,double /*currentTime
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_mutex_deletedGlProgramCache);
const GL2Extensions* extensions = GL2Extensions::Get(contextID,true);
if( ! extensions->isGlslSupported() ) return;
if( ! extensions->isGlslSupported ) return;
const osg::Timer& timer = *osg::Timer::instance();
osg::Timer_t start_tick = timer.tick();
@@ -441,8 +441,8 @@ void Program::removeBindUniformBlock(const std::string& name)
void Program::apply( osg::State& state ) const
{
const unsigned int contextID = state.getContextID();
const GL2Extensions* extensions = GL2Extensions::Get(contextID,true);
if( ! extensions->isGlslSupported() ) return;
const GL2Extensions* extensions = state.get<GL2Extensions>();
if( ! extensions->isGlslSupported ) return;
if( isFixedFunction() )
{
@@ -532,9 +532,9 @@ Program::PerContextProgram::PerContextProgram(const Program* program, unsigned i
_ownsProgramHandle(false)
{
_program = program;
_extensions = GL2Extensions::Get( _contextID, true );
if (_glProgramHandle == 0)
{
_extensions = GL2Extensions::Get( _contextID, true );
_glProgramHandle = _extensions->glCreateProgram();
_ownsProgramHandle = true;
}
@@ -581,7 +581,7 @@ void Program::PerContextProgram::linkProgram(osg::State& state)
if (!_loadedBinary)
{
if (_extensions->isGeometryShader4Supported())
if (_extensions->isGeometryShader4Supported)
{
_extensions->glProgramParameteri( _glProgramHandle, GL_GEOMETRY_VERTICES_OUT_EXT, _program->_geometryVerticesOut );
_extensions->glProgramParameteri( _glProgramHandle, GL_GEOMETRY_INPUT_TYPE_EXT, _program->_geometryInputType );
@@ -678,7 +678,7 @@ void Program::PerContextProgram::linkProgram(osg::State& state)
}
}
if (_extensions->isUniformBufferObjectSupported())
if (_extensions->isUniformBufferObjectSupported)
{
GLuint activeUniformBlocks = 0;
GLsizei maxBlockNameLen = 0;
@@ -779,7 +779,7 @@ void Program::PerContextProgram::linkProgram(osg::State& state)
// print atomic counter
if (_extensions->isShaderAtomicCounterSupported() && !atomicCounterMap.empty())
if (_extensions->isShaderAtomicCountersSupported && !atomicCounterMap.empty())
{
std::vector<GLint> bufferIndex( atomicCounterMap.size(), 0 );
std::vector<GLuint> uniformIndex;