Moved osg::Drawable::Extensions into osg::GL2Extensions

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14575 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-12-05 17:26:42 +00:00
parent 1ce8029f39
commit f634152de0
13 changed files with 183 additions and 1026 deletions

View File

@@ -37,10 +37,6 @@
#include <OpenThreads/Thread>
typedef osg::buffered_value< osg::ref_ptr< osg::Drawable::Extensions > > OcclusionQueryBufferedExtensions;
static OcclusionQueryBufferedExtensions s_OQ_bufferedExtensions;
//
// Support classes, used by (and private to) OcclusionQueryNode.
// (Note a lot of this is historical. OcclusionQueryNode formaerly
@@ -104,7 +100,7 @@ struct RetrieveQueriesCallback : public osg::Camera::DrawCallback
typedef std::vector<osg::TestResult*> ResultsVector;
ResultsVector _results;
RetrieveQueriesCallback( osg::Drawable::Extensions* ext=NULL )
RetrieveQueriesCallback( osg::GL2Extensions* ext=NULL )
: _extensionsFallback( ext )
{
}
@@ -122,14 +118,12 @@ struct RetrieveQueriesCallback : public osg::Camera::DrawCallback
double elapsedTime( 0. );
int count( 0 );
osg::Drawable::Extensions* ext;
const osg::GL2Extensions* ext=0;
if (camera.getGraphicsContext())
{
// The typical path, for osgViewer-based applications or any
// app that has set up a valid GraphicsCOntext for the Camera.
unsigned int contextID = camera.getGraphicsContext()->getState()->getContextID();
RetrieveQueriesCallback* const_this = const_cast<RetrieveQueriesCallback*>( this );
ext = const_this->getExtensions( contextID, true );
ext = camera.getGraphicsContext()->getState()->get<osg::GL2Extensions>();
}
else
{
@@ -210,15 +204,7 @@ struct RetrieveQueriesCallback : public osg::Camera::DrawCallback
_results.push_back( tr );
}
osg::Drawable::Extensions* getExtensions( unsigned int contextID, bool createIfNotInitalized )
{
if (!s_OQ_bufferedExtensions[ contextID ] && createIfNotInitalized)
s_OQ_bufferedExtensions[ contextID ] = new osg::Drawable::Extensions( contextID );
return s_OQ_bufferedExtensions[ contextID ].get();
}
osg::Drawable::Extensions* _extensionsFallback;
osg::GL2Extensions* _extensionsFallback;
};
@@ -293,7 +279,7 @@ void
QueryGeometry::drawImplementation( osg::RenderInfo& renderInfo ) const
{
unsigned int contextID = renderInfo.getState()->getContextID();
osg::Drawable::Extensions* ext = getExtensions( contextID, true );
osg::GL2Extensions* ext = renderInfo.getState()->get<GL2Extensions>();
osg::Camera* cam = renderInfo.getCurrentCamera();
// Add callbacks if necessary.
@@ -426,7 +412,7 @@ QueryGeometry::flushDeletedQueryObjects( unsigned int contextID, double /*curren
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_mutex_deletedQueryObjectCache);
const osg::Drawable::Extensions* extensions = getExtensions( contextID, true );
const osg::GL2Extensions* extensions = osg::GL2Extensions::Get( contextID, true );
QueryObjectList& qol = s_deletedQueryObjectCache[contextID];