Moved GL2Extensions functionality into the include/osg/GLExtensions header and new GLExtensions object.

Moved the #defines into new include/osg/GLDefines
Converted all GL2Extensions usage to GLExtensions usage


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14593 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-12-10 10:38:12 +00:00
parent 09205544b7
commit 485709f708
66 changed files with 1355 additions and 155 deletions

View File

@@ -132,7 +132,7 @@ void getPossibleConfigs(GraphicsContext* gc, BufferConfigList& colorConfigs,
unsigned contextID = gc->getState()->getContextID();
colorConfigs.push_back(BufferConfig("RGBA8", GL_RGBA8, 8));
depthConfigs.push_back(BufferConfig("D24", GL_DEPTH_COMPONENT24, 24));
osg::GL2Extensions* ext = gc->getState()->get<GL2Extensions>();
osg::GLExtensions* ext = gc->getState()->get<GLExtensions>();
if (!ext->isRenderbufferMultisampleSupported())
return;
if (ext->isMultisampleSupported)
@@ -156,7 +156,7 @@ void getPossibleConfigs(GraphicsContext* gc, BufferConfigList& colorConfigs,
bool checkFramebufferStatus(GraphicsContext* gc, bool silent = false)
{
State& state = *gc->getState();
osg::GL2Extensions* ext = gc->getState()->get<GL2Extensions>();
osg::GLExtensions* ext = gc->getState()->get<GLExtensions>();
switch(ext->glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT)) {
case GL_FRAMEBUFFER_COMPLETE_EXT:
break;
@@ -241,7 +241,7 @@ bool createFBO(GraphicsContext* gc, FboConfig &config, FboData &data)
}
State& state = *gc->getState();
unsigned int contextID = state.getContextID();
osg::GL2Extensions* ext = gc->getState()->get<GL2Extensions>();
osg::GLExtensions* ext = gc->getState()->get<GLExtensions>();
data.fb->apply(state);
result = checkFramebufferStatus(gc, true);
@@ -758,7 +758,7 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments)
}
unsigned int contextID = gc->getState()->getContextID();
osg::GL2Extensions* ext = gc->getState()->get<GL2Extensions>();
osg::GLExtensions* ext = gc->getState()->get<GLExtensions>();
if (!ext->isFrameBufferObjectSupported)
{
OSG_NOTIFY(NOTICE) << "Frame buffer objects are not supported\n";
@@ -766,7 +766,7 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments)
gc->close(true);
return 0;
}
if (isGLExtensionSupported(contextID, "GL_ARB_depth_buffer_float"))
depthTextureEnum = GL_DEPTH_COMPONENT32F;
else if (isGLExtensionSupported(contextID, "GL_NV_depth_buffer_float"))

View File

@@ -94,7 +94,7 @@ int main( int argc, char **argv )
contextID<osg::DisplaySettings::instance()->getMaxNumberOfGraphicsContexts();
++contextID)
{
osg::GL2Extensions* textExt = osg::GL2Extensions::Get(contextID,false);
osg::GLExtensions* textExt = osg::GLExtensions::Get(contextID,false);
if (textExt)
{
if (!textExt->isMultiTexturingSupported)

View File

@@ -86,7 +86,7 @@ public:
// check if we need to do some depth buffer copying from a source FBO into the current FBO
if (_source_fbo.get() != NULL)
{
osg::GL2Extensions* ext = renderInfo.getState()->get<osg::GL2Extensions>();
osg::GLExtensions* ext = renderInfo.getState()->get<osg::GLExtensions>();
bool fbo_supported = ext && ext->isFrameBufferObjectSupported;
if (fbo_supported && ext->glBlitFramebuffer)
{
@@ -131,7 +131,7 @@ public:
// only unbind the fbo if this is the last transparency pass
if (_restore)
{
renderInfo.getState()->get<osg::GL2Extensions>()->glBindFramebuffer( GL_FRAMEBUFFER_EXT, 0 );
renderInfo.getState()->get<osg::GLExtensions>()->glBindFramebuffer( GL_FRAMEBUFFER_EXT, 0 );
}
}
protected:

View File

@@ -137,7 +137,7 @@ class WindowCaptureCallback : public osg::Camera::DrawCallback
void read()
{
osg::GL2Extensions* ext = osg::GL2Extensions::Get(_gc->getState()->getContextID(),true);
osg::GLExtensions* ext = osg::GLExtensions::Get(_gc->getState()->getContextID(),true);
if (ext->isPBOSupported && !_pboBuffer.empty())
{
@@ -158,9 +158,9 @@ class WindowCaptureCallback : public osg::Camera::DrawCallback
void readPixels();
void singlePBO(osg::GL2Extensions* ext);
void singlePBO(osg::GLExtensions* ext);
void multiPBO(osg::GL2Extensions* ext);
void multiPBO(osg::GLExtensions* ext);
typedef std::vector< osg::ref_ptr<osg::Image> > ImageBuffer;
typedef std::vector< GLuint > PBOBuffer;
@@ -325,7 +325,7 @@ void WindowCaptureCallback::ContextData::readPixels()
_currentPboIndex = nextPboIndex;
}
void WindowCaptureCallback::ContextData::singlePBO(osg::GL2Extensions* ext)
void WindowCaptureCallback::ContextData::singlePBO(osg::GLExtensions* ext)
{
// std::cout<<"singelPBO( "<<_fileName<<" image "<<_currentImageIndex<<" "<<_currentPboIndex<<std::endl;
@@ -403,7 +403,7 @@ void WindowCaptureCallback::ContextData::singlePBO(osg::GL2Extensions* ext)
_currentImageIndex = nextImageIndex;
}
void WindowCaptureCallback::ContextData::multiPBO(osg::GL2Extensions* ext)
void WindowCaptureCallback::ContextData::multiPBO(osg::GLExtensions* ext)
{
// std::cout<<"multiPBO( "<<_fileName<<" image "<<_currentImageIndex<<" "<<_currentPboIndex<<std::endl;
unsigned int nextImageIndex = (_currentImageIndex+1)%_imageBuffer.size();

View File

@@ -404,7 +404,7 @@ int main(int argc, char *argv[])
++itr)
{
unsigned int contextID = (*itr)->getState()->getContextID();
osg::GL2Extensions* vpExt = osg::GL2Extensions::Get(contextID,false);
osg::GLExtensions* vpExt = osg::GLExtensions::Get(contextID,false);
if (vpExt)
{
if (!vpExt->isVertexProgramSupported)