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:
@@ -918,8 +918,8 @@ void FrameBufferObject::apply(State &state, BindTarget target) const
|
||||
{
|
||||
if (_drawBuffers.size() > 0)
|
||||
{
|
||||
GL2Extensions *gl2e = GL2Extensions::Get(state.getContextID(), true );
|
||||
if (gl2e && gl2e->isDrawBuffersSupported())
|
||||
GL2Extensions *gl2e = state.get<GL2Extensions>();
|
||||
if (gl2e && gl2e->glDrawBuffers)
|
||||
{
|
||||
gl2e->glDrawBuffers(_drawBuffers.size(), &(_drawBuffers[0]));
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -31,10 +31,10 @@ PatchParameter::~PatchParameter()
|
||||
|
||||
void PatchParameter::apply(State& state) const
|
||||
{
|
||||
GL2Extensions* extensions = GL2Extensions::Get( state.getContextID(), true );
|
||||
if (extensions->areTessellationShadersSupported() )
|
||||
GL2Extensions* extensions = state.get<GL2Extensions>();
|
||||
if (extensions->areTessellationShadersSupported )
|
||||
{
|
||||
|
||||
|
||||
extensions->glPatchParameteri( GL_PATCH_VERTICES, _vertices );
|
||||
extensions->glPatchParameterfv( GL_PATCH_DEFAULT_INNER_LEVEL, _patchDefaultInnerLevel.ptr() );
|
||||
extensions->glPatchParameterfv( GL_PATCH_DEFAULT_OUTER_LEVEL, _patchDefaultOuterLevel.ptr() );
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -178,7 +178,7 @@ void Shader::flushDeletedGlShaders(unsigned int contextID,double /*currentTime*/
|
||||
if (availableTime<=0.0) return;
|
||||
|
||||
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();
|
||||
|
||||
@@ -131,6 +131,10 @@ State::State():
|
||||
|
||||
State::~State()
|
||||
{
|
||||
// delete the GL2Extensions object associated with this osg::State.
|
||||
GL2Extensions::Set(_contextID, 0);
|
||||
_gl2Extentsions = 0;
|
||||
|
||||
//_texCoordArrayList.clear();
|
||||
|
||||
//_vertexAttribArrayList.clear();
|
||||
@@ -918,6 +922,9 @@ void State::initializeExtensionProcs()
|
||||
{
|
||||
if (_extensionProcsInitialized) return;
|
||||
|
||||
_gl2Extentsions = new GL2Extensions(_contextID);
|
||||
GL2Extensions::Set(_contextID, _gl2Extentsions.get());
|
||||
|
||||
setGLExtensionFuncPtr(_glClientActiveTexture,"glClientActiveTexture","glClientActiveTextureARB");
|
||||
setGLExtensionFuncPtr(_glActiveTexture, "glActiveTexture","glActiveTextureARB");
|
||||
setGLExtensionFuncPtr(_glFogCoordPointer, "glFogCoordPointer","glFogCoordPointerEXT");
|
||||
|
||||
Reference in New Issue
Block a user