From 485709f70888b48bfedbb72f6b3a2d8ab0c4ca7f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 10 Dec 2014 10:38:12 +0000 Subject: [PATCH] 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 --- examples/osgfpdepth/osgfpdepth.cpp | 10 +- examples/osgmultitexture/osgmultitexture.cpp | 2 +- examples/osgoit/DepthPeeling.cpp | 4 +- .../osgscreencapture/osgscreencapture.cpp | 10 +- .../osgvertexprogram/osgvertexprogram.cpp | 2 +- include/osg/BufferObject | 4 +- include/osg/FrameBufferObject | 8 +- include/osg/GL2Extensions | 10 +- include/osg/GLExtensions | 459 +++++++++++ include/osg/PatchParameter | 5 +- include/osg/PrimitiveSet | 1 - include/osg/Program | 4 +- include/osg/Shader | 4 +- include/osg/State | 8 +- include/osg/Texture | 2 +- include/osg/TextureBuffer | 4 +- include/osg/Uniform | 4 +- include/osgViewer/Renderer | 2 +- src/osg/ArrayDispatchers.cpp | 6 +- src/osg/BlendColor.cpp | 2 +- src/osg/BlendEquation.cpp | 2 +- src/osg/BlendEquationi.cpp | 2 +- src/osg/BlendFunc.cpp | 2 +- src/osg/BlendFunci.cpp | 2 +- src/osg/BufferObject.cpp | 6 +- src/osg/CMakeLists.txt | 1 + src/osg/Capability.cpp | 4 +- src/osg/ClampColor.cpp | 2 +- src/osg/ColorMaski.cpp | 2 +- src/osg/FragmentProgram.cpp | 4 +- src/osg/FrameBufferObject.cpp | 16 +- src/osg/GLExtensions.cpp | 744 ++++++++++++++++++ src/osg/Geometry.cpp | 2 +- src/osg/GraphicsContext.cpp | 2 +- src/osg/Image.cpp | 2 +- src/osg/Multisample.cpp | 2 +- src/osg/OcclusionQueryNode.cpp | 18 +- src/osg/PatchParameter.cpp | 2 +- src/osg/Point.cpp | 2 +- src/osg/PointSprite.cpp | 4 +- src/osg/PrimitiveRestartIndex.cpp | 2 +- src/osg/Program.cpp | 8 +- src/osg/SampleMaski.cpp | 2 +- src/osg/Shader.cpp | 4 +- src/osg/State.cpp | 16 +- src/osg/Stencil.cpp | 4 +- src/osg/StencilTwoSided.cpp | 2 +- src/osg/Texture.cpp | 18 +- src/osg/Texture1D.cpp | 2 +- src/osg/Texture2DArray.cpp | 10 +- src/osg/Texture2DMultisample.cpp | 2 +- src/osg/Texture3D.cpp | 10 +- src/osg/TextureBuffer.cpp | 4 +- src/osg/TextureCubeMap.cpp | 4 +- src/osg/TextureRectangle.cpp | 6 +- src/osg/Uniform.cpp | 4 +- src/osg/VertexAttribDivisor.cpp | 4 +- src/osg/VertexProgram.cpp | 4 +- src/osgFX/SpecularHighlights.cpp | 2 +- src/osgParticle/PrecipitationEffect.cpp | 2 +- src/osgText/Glyph.cpp | 2 +- src/osgUtil/GLObjectsVisitor.cpp | 6 +- src/osgUtil/RenderStage.cpp | 4 +- src/osgViewer/Renderer.cpp | 4 +- src/osgViewer/ScreenCaptureHandler.cpp | 10 +- src/osgViewer/StatsHandler.cpp | 2 +- 66 files changed, 1355 insertions(+), 155 deletions(-) diff --git a/examples/osgfpdepth/osgfpdepth.cpp b/examples/osgfpdepth/osgfpdepth.cpp index eadf6fa94..4eabc6e6f 100644 --- a/examples/osgfpdepth/osgfpdepth.cpp +++ b/examples/osgfpdepth/osgfpdepth.cpp @@ -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(); + osg::GLExtensions* ext = gc->getState()->get(); 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(); + osg::GLExtensions* ext = gc->getState()->get(); 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(); + osg::GLExtensions* ext = gc->getState()->get(); 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(); + osg::GLExtensions* ext = gc->getState()->get(); 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")) diff --git a/examples/osgmultitexture/osgmultitexture.cpp b/examples/osgmultitexture/osgmultitexture.cpp index 022b6ad3a..2491124cb 100644 --- a/examples/osgmultitexture/osgmultitexture.cpp +++ b/examples/osgmultitexture/osgmultitexture.cpp @@ -94,7 +94,7 @@ int main( int argc, char **argv ) contextIDgetMaxNumberOfGraphicsContexts(); ++contextID) { - osg::GL2Extensions* textExt = osg::GL2Extensions::Get(contextID,false); + osg::GLExtensions* textExt = osg::GLExtensions::Get(contextID,false); if (textExt) { if (!textExt->isMultiTexturingSupported) diff --git a/examples/osgoit/DepthPeeling.cpp b/examples/osgoit/DepthPeeling.cpp index e1c8df5ff..52237d8f0 100644 --- a/examples/osgoit/DepthPeeling.cpp +++ b/examples/osgoit/DepthPeeling.cpp @@ -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::GLExtensions* ext = renderInfo.getState()->get(); 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()->glBindFramebuffer( GL_FRAMEBUFFER_EXT, 0 ); + renderInfo.getState()->get()->glBindFramebuffer( GL_FRAMEBUFFER_EXT, 0 ); } } protected: diff --git a/examples/osgscreencapture/osgscreencapture.cpp b/examples/osgscreencapture/osgscreencapture.cpp index 36014137a..2afefa359 100644 --- a/examples/osgscreencapture/osgscreencapture.cpp +++ b/examples/osgscreencapture/osgscreencapture.cpp @@ -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 > 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<getState()->getContextID(); - osg::GL2Extensions* vpExt = osg::GL2Extensions::Get(contextID,false); + osg::GLExtensions* vpExt = osg::GLExtensions::Get(contextID,false); if (vpExt) { if (!vpExt->isVertexProgramSupported) diff --git a/include/osg/BufferObject b/include/osg/BufferObject index 8f705cda5..1281c7301 100644 --- a/include/osg/BufferObject +++ b/include/osg/BufferObject @@ -16,7 +16,7 @@ #define OSG_BUFFEROBJECT 1 #include -#include +#include #include #include #include @@ -268,7 +268,7 @@ class OSG_EXPORT GLBufferObject : public Referenced unsigned int _frameLastUsed; public: - GL2Extensions* _extensions; + GLExtensions* _extensions; }; diff --git a/include/osg/FrameBufferObject b/include/osg/FrameBufferObject index 41f16ed2b..e3abdced1 100644 --- a/include/osg/FrameBufferObject +++ b/include/osg/FrameBufferObject @@ -144,7 +144,7 @@ class OSG_EXPORT RenderBuffer: public Object inline void setSamples(int samples); inline void setColorSamples(int colorSamples); - GLuint getObjectID(unsigned int contextID, const GL2Extensions *ext) const; + GLuint getObjectID(unsigned int contextID, const GLExtensions *ext) const; inline int compare(const RenderBuffer &rb) const; /** Mark internal RenderBuffer for deletion. @@ -161,7 +161,7 @@ class OSG_EXPORT RenderBuffer: public Object * this call is useful for when an OpenGL context has been destroyed. */ static void discardDeletedRenderBuffers(unsigned int contextID); - static int getMaxSamples(unsigned int contextID, const GL2Extensions* ext); + static int getMaxSamples(unsigned int contextID, const GLExtensions* ext); /** Resize any per context GLObject buffers to specified size. */ virtual void resizeGLObjectBuffers(unsigned int maxSize); @@ -303,8 +303,8 @@ class OSG_EXPORT FrameBufferAttachment FrameBufferAttachment&operator = (const FrameBufferAttachment& copy); bool isMultisample() const; - void createRequiredTexturesAndApplyGenerateMipMap(State& state, const GL2Extensions* ext) const; - void attach(State &state, GLenum target, GLenum attachment_point, const GL2Extensions* ext) const; + void createRequiredTexturesAndApplyGenerateMipMap(State& state, const GLExtensions* ext) const; + void attach(State &state, GLenum target, GLenum attachment_point, const GLExtensions* ext) const; int compare(const FrameBufferAttachment &fa) const; RenderBuffer* getRenderBuffer(); diff --git a/include/osg/GL2Extensions b/include/osg/GL2Extensions index 9a1e98d0e..9861fe26b 100644 --- a/include/osg/GL2Extensions +++ b/include/osg/GL2Extensions @@ -1,10 +1,12 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2014 Robert Osfield * Copyright (C) 2003-2005 3Dlabs Inc. Ltd. * Copyright (C) 2004-2005 Nathan Cournia * Copyright (C) 2007 Art Tevs * Copyright (C) 2008 Zebra Imaging * Copyright (C) 2010 VIRES Simulationstechnologie GmbH * Copyright (C) 2012 David Callu + * Copyright (C) 2008 Mike Weiblen + * Copyright (C) 2012 Holger Helmich * * This application is open source and may be redistributed and/or modified * freely and without restriction, both in commercial and non commercial @@ -15,17 +17,13 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -/* file: include/osg/GL2Extensions - * author: Mike Weiblen 2008-01-02 - * Holger Helmich 2010-10-21 -*/ - #ifndef OSG_GL2EXTENSIONS #define OSG_GL2EXTENSIONS 1 #include #include + #include diff --git a/include/osg/GLExtensions b/include/osg/GLExtensions index fbba8d524..b3b6a0fc8 100644 --- a/include/osg/GLExtensions +++ b/include/osg/GLExtensions @@ -15,6 +15,8 @@ #define OSG_GLEXTENSIONS 1 #include +#include + #include #include #include @@ -121,6 +123,463 @@ bool setGLExtensionFuncPtr(T& t, const char* str1, const char* str2, const char* return convertPointer(t, osg::getGLExtensionFuncPtr(str1, str2, str3)); } +/** Main GLExtensions class for managing OpenGL extensions per graphics context.*/ +class OSG_EXPORT GLExtensions : public osg::Referenced +{ + public: + GLExtensions(unsigned int contextID); + + /** Function to call to get the extension of a specified context. + * If the Exentsion object for that context has not yet been created then + * and the 'createIfNotInitalized' flag been set to false then returns NULL. + * If 'createIfNotInitalized' is true then the Extensions object is + * automatically created. However, in this case the extension object + * only be created with the graphics context associated with ContextID..*/ + static GLExtensions* Get(unsigned int contextID,bool createIfNotInitalized); + + /** allows users to override the extensions across graphics contexts. + * typically used when you have different extensions supported across graphics pipes + * but need to ensure that they all use the same low common denominator extensions.*/ + static void Set(unsigned int contextID, GLExtensions* extensions); + + // C++-friendly convenience wrapper methods + GLuint getCurrentProgram() const; + bool getProgramInfoLog( GLuint program, std::string& result ) const; + bool getShaderInfoLog( GLuint shader, std::string& result ) const; + bool getAttribLocation( const char* attribName, GLuint& slot ) const; + bool getFragDataLocation( const char* fragDataName, GLuint& slot) const; + + + float glVersion; + float glslLanguageVersion; + + bool isGlslSupported; + bool isShaderObjectsSupported; + bool isVertexShaderSupported; + bool isFragmentShaderSupported; + bool isLanguage100Supported; + bool isGeometryShader4Supported; + bool areTessellationShadersSupported; + bool isGpuShader4Supported; + bool isUniformBufferObjectSupported; + bool isGetProgramBinarySupported; + bool isGpuShaderFp64Supported; + bool isShaderAtomicCountersSupported; + bool isRectangleSupported; + bool isCubeMapSupported; + + void (GL_APIENTRY * glDrawBuffers)(GLsizei n, const GLenum *bufs); + void (GL_APIENTRY * glAttachShader)(GLuint program, GLuint shader); + void (GL_APIENTRY * glBindAttribLocation)(GLuint program, GLuint index, const GLchar *name); + void (GL_APIENTRY * glCompileShader)(GLuint shader); + GLuint (GL_APIENTRY * glCreateProgram)(void); + GLuint (GL_APIENTRY * glCreateShader)(GLenum type); + void (GL_APIENTRY * glDeleteProgram)(GLuint program); + void (GL_APIENTRY * glDeleteObjectARB)(GLuint program); + void (GL_APIENTRY * glDeleteShader)(GLuint shader); + void (GL_APIENTRY * glDetachShader)(GLuint program, GLuint shader); + void (GL_APIENTRY * glDisableVertexAttribArray)(GLuint index); + void (GL_APIENTRY * glEnableVertexAttribArray)(GLuint index); + void (GL_APIENTRY * glGetActiveAttrib)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); + void (GL_APIENTRY * glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); + void (GL_APIENTRY * glGetAttachedShaders)(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); + GLint (GL_APIENTRY * glGetAttribLocation)(GLuint program, const GLchar *name); + void (GL_APIENTRY * glGetProgramiv)(GLuint program, GLenum pname, GLint *params); + void (GL_APIENTRY * glGetObjectParameterivARB)(GLuint program, GLenum pname, GLint *params); + void (GL_APIENTRY * glGetProgramInfoLog)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); + void (GL_APIENTRY * glGetInfoLogARB)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); + void (GL_APIENTRY * glGetShaderiv)(GLuint shader, GLenum pname, GLint *params); + void (GL_APIENTRY * glGetShaderInfoLog)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); + void (GL_APIENTRY * glGetShaderSource)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); + GLint (GL_APIENTRY * glGetUniformLocation)(GLuint program, const GLchar *name); + void (GL_APIENTRY * glGetUniformfv)(GLuint program, GLint location, GLfloat *params); + void (GL_APIENTRY * glGetUniformiv)(GLuint program, GLint location, GLint *params); + void (GL_APIENTRY * glGetVertexAttribdv)(GLuint index, GLenum pname, GLdouble *params); + void (GL_APIENTRY * glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat *params); + void (GL_APIENTRY * glGetVertexAttribiv)(GLuint index, GLenum pname, GLint *params); + void (GL_APIENTRY * glGetVertexAttribPointerv)(GLuint index, GLenum pname, GLvoid* *pointer); + GLboolean (GL_APIENTRY * glIsProgram)(GLuint program); + GLboolean (GL_APIENTRY * glIsShader)(GLuint shader); + void (GL_APIENTRY * glLinkProgram)(GLuint program); + void (GL_APIENTRY * glShaderSource)(GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); + void (GL_APIENTRY * glUseProgram)(GLuint program); + void (GL_APIENTRY * glUniform1f)(GLint location, GLfloat v0); + void (GL_APIENTRY * glUniform2f)(GLint location, GLfloat v0, GLfloat v1); + void (GL_APIENTRY * glUniform3f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); + void (GL_APIENTRY * glUniform4f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); + void (GL_APIENTRY * glUniform1i)(GLint location, GLint v0); + void (GL_APIENTRY * glUniform2i)(GLint location, GLint v0, GLint v1); + void (GL_APIENTRY * glUniform3i)(GLint location, GLint v0, GLint v1, GLint v2); + void (GL_APIENTRY * glUniform4i)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); + void (GL_APIENTRY * glUniform1fv)(GLint location, GLsizei count, const GLfloat *value); + void (GL_APIENTRY * glUniform2fv)(GLint location, GLsizei count, const GLfloat *value); + void (GL_APIENTRY * glUniform3fv)(GLint location, GLsizei count, const GLfloat *value); + void (GL_APIENTRY * glUniform4fv)(GLint location, GLsizei count, const GLfloat *value); + void (GL_APIENTRY * glUniform1iv)(GLint location, GLsizei count, const GLint *value); + void (GL_APIENTRY * glUniform2iv)(GLint location, GLsizei count, const GLint *value); + void (GL_APIENTRY * glUniform3iv)(GLint location, GLsizei count, const GLint *value); + void (GL_APIENTRY * glUniform4iv)(GLint location, GLsizei count, const GLint *value); + void (GL_APIENTRY * glUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + void (GL_APIENTRY * glUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + void (GL_APIENTRY * glUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + void (GL_APIENTRY * glValidateProgram)(GLuint program); + void (GL_APIENTRY * glVertexAttrib1d)(GLuint index, GLdouble x); + void (GL_APIENTRY * glVertexAttrib1dv)(GLuint index, const GLdouble *v); + void (GL_APIENTRY * glVertexAttrib1f)(GLuint index, GLfloat x); + void (GL_APIENTRY * glVertexAttrib1fv)(GLuint index, const GLfloat *v); + void (GL_APIENTRY * glVertexAttrib1s)(GLuint index, GLshort x); + void (GL_APIENTRY * glVertexAttrib1sv)(GLuint index, const GLshort *v); + void (GL_APIENTRY * glVertexAttrib2d)(GLuint index, GLdouble x, GLdouble y); + void (GL_APIENTRY * glVertexAttrib2dv)(GLuint index, const GLdouble *v); + void (GL_APIENTRY * glVertexAttrib2f)(GLuint index, GLfloat x, GLfloat y); + void (GL_APIENTRY * glVertexAttrib2fv)(GLuint index, const GLfloat *v); + void (GL_APIENTRY * glVertexAttrib2s)(GLuint index, GLshort x, GLshort y); + void (GL_APIENTRY * glVertexAttrib2sv)(GLuint index, const GLshort *v); + void (GL_APIENTRY * glVertexAttrib3d)(GLuint index, GLdouble x, GLdouble y, GLdouble z); + void (GL_APIENTRY * glVertexAttrib3dv)(GLuint index, const GLdouble *v); + void (GL_APIENTRY * glVertexAttrib3f)(GLuint index, GLfloat x, GLfloat y, GLfloat z); + void (GL_APIENTRY * glVertexAttrib3fv)(GLuint index, const GLfloat *v); + void (GL_APIENTRY * glVertexAttrib3s)(GLuint index, GLshort x, GLshort y, GLshort z); + void (GL_APIENTRY * glVertexAttrib3sv)(GLuint index, const GLshort *v); + void (GL_APIENTRY * glVertexAttrib4Nbv)(GLuint index, const GLbyte *v); + void (GL_APIENTRY * glVertexAttrib4Niv)(GLuint index, const GLint *v); + void (GL_APIENTRY * glVertexAttrib4Nsv)(GLuint index, const GLshort *v); + void (GL_APIENTRY * glVertexAttrib4Nub)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); + void (GL_APIENTRY * glVertexAttrib4Nubv)(GLuint index, const GLubyte *v); + void (GL_APIENTRY * glVertexAttrib4Nuiv)(GLuint index, const GLuint *v); + void (GL_APIENTRY * glVertexAttrib4Nusv)(GLuint index, const GLushort *v); + void (GL_APIENTRY * glVertexAttrib4bv)(GLuint index, const GLbyte *v); + void (GL_APIENTRY * glVertexAttrib4d)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); + void (GL_APIENTRY * glVertexAttrib4dv)(GLuint index, const GLdouble *v); + void (GL_APIENTRY * glVertexAttrib4f)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void (GL_APIENTRY * glVertexAttrib4fv)(GLuint index, const GLfloat *v); + void (GL_APIENTRY * glVertexAttrib4iv)(GLuint index, const GLint *v); + void (GL_APIENTRY * glVertexAttrib4s)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); + void (GL_APIENTRY * glVertexAttrib4sv)(GLuint index, const GLshort *v); + void (GL_APIENTRY * glVertexAttrib4ubv)(GLuint index, const GLubyte *v); + void (GL_APIENTRY * glVertexAttrib4uiv)(GLuint index, const GLuint *v); + void (GL_APIENTRY * glVertexAttrib4usv)(GLuint index, const GLushort *v); + void (GL_APIENTRY * glVertexAttribPointer)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); + void (GL_APIENTRY * glVertexAttribDivisor)(GLuint index, GLuint divisor); + void (GL_APIENTRY * glUniformMatrix2x3fv)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); + void (GL_APIENTRY * glUniformMatrix3x2fv)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); + void (GL_APIENTRY * glUniformMatrix2x4fv)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); + void (GL_APIENTRY * glUniformMatrix4x2fv)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); + void (GL_APIENTRY * glUniformMatrix3x4fv)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); + void (GL_APIENTRY * glUniformMatrix4x3fv)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); + void (GL_APIENTRY * glProgramParameteri)( GLuint program, GLenum pname, GLint value ); + void (GL_APIENTRY * glPatchParameteri)( GLenum pname, GLint value ); + void (GL_APIENTRY * glPatchParameterfv)( GLenum pname, const GLfloat* values ); + void (GL_APIENTRY * glGetUniformuiv)( GLuint program, GLint location, GLuint* params ); + void (GL_APIENTRY * glBindFragDataLocation)( GLuint program, GLuint color, const GLchar* name ); + GLint (GL_APIENTRY * glGetFragDataLocation)( GLuint program, const GLchar* name ); + void (GL_APIENTRY * glUniform1ui)( GLint location, GLuint v0 ); + void (GL_APIENTRY * glUniform2ui)( GLint location, GLuint v0, GLuint v1 ); + void (GL_APIENTRY * glUniform3ui)( GLint location, GLuint v0, GLuint v1, GLuint v2 ); + void (GL_APIENTRY * glUniform4ui)( GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3 ); + void (GL_APIENTRY * glUniform1uiv)( GLint location, GLsizei count, const GLuint *value ); + void (GL_APIENTRY * glUniform2uiv)( GLint location, GLsizei count, const GLuint *value ); + void (GL_APIENTRY * glUniform3uiv)( GLint location, GLsizei count, const GLuint *value ); + void (GL_APIENTRY * glUniform4uiv)( GLint location, GLsizei count, const GLuint *value ); + GLuint (GL_APIENTRY * glGetHandleARB) (GLenum pname); + void (GL_APIENTRY * glGetUniformIndices)(GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices); + void (GL_APIENTRY * glGetActiveUniformsiv)(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); + void (GL_APIENTRY * glGetActiveUniformName)(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); + GLuint (GL_APIENTRY * glGetUniformBlockIndex)(GLuint program, const GLchar *uniformBlockName); + void (GL_APIENTRY * glGetActiveUniformBlockiv)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); + void (GL_APIENTRY * glGetActiveUniformBlockName)(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); + void (GL_APIENTRY * glUniformBlockBinding)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); + void (GL_APIENTRY * glGetProgramBinary)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); + void (GL_APIENTRY * glProgramBinary)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length); + void (GL_APIENTRY * glUniform1d)(GLint location, GLdouble v0); + void (GL_APIENTRY * glUniform2d)(GLint location, GLdouble v0, GLdouble v1); + void (GL_APIENTRY * glUniform3d)(GLint location, GLdouble v0, GLdouble v1, GLdouble v2); + void (GL_APIENTRY * glUniform4d)(GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); + void (GL_APIENTRY * glUniform1dv)(GLint location, GLsizei count, const GLdouble *value); + void (GL_APIENTRY * glUniform2dv)(GLint location, GLsizei count, const GLdouble *value); + void (GL_APIENTRY * glUniform3dv)(GLint location, GLsizei count, const GLdouble *value); + void (GL_APIENTRY * glUniform4dv)(GLint location, GLsizei count, const GLdouble *value); + void (GL_APIENTRY * glUniformMatrix2dv)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); + void (GL_APIENTRY * glUniformMatrix3dv)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); + void (GL_APIENTRY * glUniformMatrix4dv)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); + void (GL_APIENTRY * glUniformMatrix2x3dv)( GLint location, GLsizei count, GLboolean transpose, const GLdouble* value ); + void (GL_APIENTRY * glUniformMatrix3x2dv)( GLint location, GLsizei count, GLboolean transpose, const GLdouble* value ); + void (GL_APIENTRY * glUniformMatrix2x4dv)( GLint location, GLsizei count, GLboolean transpose, const GLdouble* value ); + void (GL_APIENTRY * glUniformMatrix4x2dv)( GLint location, GLsizei count, GLboolean transpose, const GLdouble* value ); + void (GL_APIENTRY * glUniformMatrix3x4dv)( GLint location, GLsizei count, GLboolean transpose, const GLdouble* value ); + void (GL_APIENTRY * glUniformMatrix4x3dv)( GLint location, GLsizei count, GLboolean transpose, const GLdouble* value ); + void (GL_APIENTRY * glGetActiveAtomicCounterBufferiv)( GLuint program, GLuint bufferIndex, GLenum pname, GLint* params ); + void (GL_APIENTRY * glDispatchCompute)( GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ ); + + // Buffer Object extensions + bool isBufferObjectSupported; + bool isPBOSupported; + bool isTBOSupported; + + void (GL_APIENTRY * glGenBuffers) (GLsizei n, GLuint *buffers); + void (GL_APIENTRY * glBindBuffer) (GLenum target, GLuint buffer); + void (GL_APIENTRY * glBufferData) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); + void (GL_APIENTRY * glBufferSubData) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); + void (GL_APIENTRY * glDeleteBuffers) (GLsizei n, const GLuint *buffers); + GLboolean (GL_APIENTRY * glIsBuffer) (GLuint buffer); + void (GL_APIENTRY * glGetBufferSubData) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); + GLvoid* (GL_APIENTRY * glMapBuffer) (GLenum target, GLenum access); + GLvoid* (GL_APIENTRY * glMapBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); + GLboolean (GL_APIENTRY * glUnmapBuffer) (GLenum target); + void (GL_APIENTRY * glGetBufferParameteriv) (GLenum target, GLenum pname, GLint *params); + void (GL_APIENTRY * glGetBufferPointerv) (GLenum target, GLenum pname, GLvoid* *params); + void (GL_APIENTRY * glBindBufferRange) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); + void (GL_APIENTRY * glBindBufferBase) (GLenum target, GLuint index, GLuint buffer); + void (GL_APIENTRY * glTexBuffer) (GLenum target, GLenum internalFormat, GLuint buffer); + + void (GL_APIENTRY * glMemoryBarrier)( GLbitfield barriers ); + + // BlendFunc extensions + bool isBlendFuncSeparateSupported; + void (GL_APIENTRY * glBlendFuncSeparate) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) ; + + void (GL_APIENTRY * glBlendFunci) (GLuint buf, GLenum src, GLenum dst); + void (GL_APIENTRY * glBlendFuncSeparatei) (GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) ; + + + // Vertex Array extensions + bool isSecondaryColorSupported; + bool isFogCoordSupported; + bool isMultiTexSupported; + bool isOcclusionQuerySupported; + bool isARBOcclusionQuerySupported; + bool isTimerQuerySupported; + bool isARBTimerQuerySupported; + + void (GL_APIENTRY * glSecondaryColor3ubv) (const GLubyte* coord); + void (GL_APIENTRY * glSecondaryColor3fv) (const GLfloat* coord); + + void (GL_APIENTRY * glFogCoordfv) (const GLfloat* coord); + + void (GL_APIENTRY * glMultiTexCoord1f) (GLenum target,GLfloat coord); + void (GL_APIENTRY * glMultiTexCoord1fv) (GLenum target,const GLfloat* coord); + void (GL_APIENTRY * glMultiTexCoord2fv) (GLenum target,const GLfloat* coord); + void (GL_APIENTRY * glMultiTexCoord3fv) (GLenum target,const GLfloat* coord); + void (GL_APIENTRY * glMultiTexCoord4fv) (GLenum target,const GLfloat* coord); + + void (GL_APIENTRY * glMultiTexCoord1d) (GLenum target,GLdouble coord); + void (GL_APIENTRY * glMultiTexCoord1dv) (GLenum target,const GLdouble* coord); + void (GL_APIENTRY * glMultiTexCoord2dv) (GLenum target,const GLdouble* coord); + void (GL_APIENTRY * glMultiTexCoord3dv) (GLenum target,const GLdouble* coord); + void (GL_APIENTRY * glMultiTexCoord4dv) (GLenum target,const GLdouble* coord); + + // Occlusion Query extensions + void (GL_APIENTRY * glGenOcclusionQueries) ( GLsizei n, GLuint *ids ); + void (GL_APIENTRY * glDeleteOcclusionQueries) ( GLsizei n, const GLuint *ids ); + GLboolean (GL_APIENTRY * glIsOcclusionQuery) ( GLuint id ); + void (GL_APIENTRY * glBeginOcclusionQuery) ( GLuint id ); + void (GL_APIENTRY * glEndOcclusionQuery) (); + void (GL_APIENTRY * glGetOcclusionQueryiv) ( GLuint id, GLenum pname, GLint *params ); + void (GL_APIENTRY * glGetOcclusionQueryuiv) ( GLuint id, GLenum pname, GLuint *params ); + + void (GL_APIENTRY * glGetQueryiv) (GLenum target, GLenum pname, GLint *params); + void (GL_APIENTRY * glGenQueries) (GLsizei n, GLuint *ids); + void (GL_APIENTRY * glBeginQuery) (GLenum target, GLuint id); + void (GL_APIENTRY * glEndQuery) (GLenum target); + void (GL_APIENTRY * glQueryCounter) (GLuint id, GLenum target); + GLboolean (GL_APIENTRY * glIsQuery) (GLuint id); + void (GL_APIENTRY * glDeleteQueries) (GLsizei n, const GLuint *ids); + void (GL_APIENTRY * glGetQueryObjectiv) (GLuint id, GLenum pname, GLint *params); + void (GL_APIENTRY * glGetQueryObjectuiv) (GLuint id, GLenum pname, GLuint *params); + void (GL_APIENTRY * glGetQueryObjectui64v) (GLuint id, GLenum pname, GLuint64 *params); + void (GL_APIENTRY * glGetInteger64v) (GLenum pname, GLint64 *params); + + + // SampleMaski functionality + bool isOpenGL32upported; + bool isTextureMultisampleSupported; + bool isSampleMaskiSupported; + + void (GL_APIENTRY * glSampleMaski) (GLuint maskNumber, GLbitfield mask); + + // Vertex/Fragment Programs + bool isVertexProgramSupported; + bool isFragmentProgramSupported; + + void (GL_APIENTRY * glBindProgram) (GLenum target, GLuint id); + void (GL_APIENTRY * glGenPrograms) (GLsizei n, GLuint *programs); + void (GL_APIENTRY * glDeletePrograms) (GLsizei n, GLuint *programs); + void (GL_APIENTRY * glProgramString) (GLenum target, GLenum format, GLsizei len, const void *string); + void (GL_APIENTRY * glProgramLocalParameter4fv) (GLenum target, GLuint index, const GLfloat *params); + + + // Texture Extensions + bool isMultiTexturingSupported; + bool isTextureFilterAnisotropicSupported; + bool isTextureSwizzleSupported; + bool isTextureCompressionARBSupported; + bool isTextureCompressionS3TCSupported; + bool isTextureCompressionPVRTC2BPPSupported; + bool isTextureCompressionPVRTC4BPPSupported; + bool isTextureCompressionETCSupported; + bool isTextureCompressionETC2Supported; + bool isTextureCompressionRGTCSupported; + bool isTextureCompressionPVRTCSupported; + bool isTextureMirroredRepeatSupported; + bool isTextureEdgeClampSupported; + bool isTextureBorderClampSupported; + bool isGenerateMipMapSupported; + bool preferGenerateMipmapSGISForPowerOfTwo; + bool isTextureMultisampledSupported; + bool isShadowSupported; + bool isShadowAmbientSupported; + bool isTextureMaxLevelSupported; + GLint maxTextureSize; + bool _isTextureStorageEnabled; + bool isClientStorageSupported; + bool isTextureIntegerEXTSupported; + bool isTextureStorageEnabled; + + bool isTexStorage2DSupported() const { return glTexStorage2D != 0; } + bool isCompressedTexImage2DSupported() const { return glCompressedTexImage2D!=0; } + bool isCompressedTexSubImage2DSupported() const { return glCompressedTexSubImage2D!=0; } + bool isBindImageTextureSupported() const { return glBindImageTexture!=0; } + bool isNonPowerOfTwoTextureMipMappedSupported; + bool isNonPowerOfTwoTextureNonMipMappedSupported; + bool isNonPowerOfTwoTextureSupported(GLenum filter) const + { + return (filter==GL_LINEAR || filter==GL_NEAREST) ? + isNonPowerOfTwoTextureNonMipMappedSupported : + isNonPowerOfTwoTextureMipMappedSupported; + } + + void (GL_APIENTRY * glTexStorage2D) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); + void (GL_APIENTRY * glCompressedTexImage2D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); + void (GL_APIENTRY * glCompressedTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); + void (GL_APIENTRY * glGetCompressedTexImage) (GLenum target, GLint level, GLvoid *data); + void (GL_APIENTRY * glTexImage2DMultisample) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); + void (GL_APIENTRY * glTexParameterIiv) (GLenum target, GLenum pname, const GLint* data); + void (GL_APIENTRY * glTexParameterIuiv) (GLenum target, GLenum pname, const GLuint* data); + void (GL_APIENTRY * glBindImageTexture) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); + + // Texture3D extensions + bool isTexture3DSupported; + bool isTexture3DFast; + GLint maxTexture3DSize; + bool isCompressedTexImage3DSupported() const { return glCompressedTexImage3D!=0; } + bool isCompressedTexSubImage3DSupported() const { return glCompressedTexSubImage3D!=0; } + + void (GL_APIENTRY * glTexImage3D) ( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); + void (GL_APIENTRY * glTexSubImage3D) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); + void (GL_APIENTRY * glCopyTexSubImage3D) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); + void (GL_APIENTRY * glCompressedTexImage3D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); + void (GL_APIENTRY * glCompressedTexSubImage3D) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data ); + + // Texture2DArray extensions + bool isTexture2DArraySupported; + GLint maxLayerCount; + GLint max2DSize; + + + // Blending + bool isBlendColorSupported; + bool isBlendEquationSupported; + bool isBlendEquationSeparateSupported; + bool isSGIXMinMaxSupported; + bool isLogicOpSupported; + + void (GL_APIENTRY * glBlendColor) (GLclampf red , GLclampf green , GLclampf blue , GLclampf alpha); + void (GL_APIENTRY * glBlendEquation)(GLenum mode); + void (GL_APIENTRY * glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha); + void (GL_APIENTRY * glBlendEquationi)(GLuint buf, GLenum mode); + void (GL_APIENTRY * glBlendEquationSeparatei)(GLuint buf, GLenum modeRGB, GLenum modeAlpha); + + + // glEnablei/glDisabeli + void (GL_APIENTRY * glEnablei) (GLenum capability, GLuint buf); + void (GL_APIENTRY * glDisablei) (GLenum capability, GLuint buf); + + + // Stencil + bool isStencilWrapSupported; + bool isStencilTwoSidedSupported; + bool isOpenGL20Supported; + bool isSeparateStencilSupported; + + void (GL_APIENTRY * glActiveStencilFace) (GLenum face); + void (GL_APIENTRY * glStencilOpSeparate) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); + void (GL_APIENTRY * glStencilMaskSeparate) (GLenum face, GLuint mask); + void (GL_APIENTRY * glStencilFuncSeparate) (GLenum face, GLenum func, GLint ref, GLuint mask); + void (GL_APIENTRY * glStencilFuncSeparateATI) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); + + + // ColorMask + void (GL_APIENTRY * glColorMaski)(GLuint buf, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); + + + // ClampColor + bool isClampColorSupported; + void (GL_APIENTRY * glClampColor) (GLenum target, GLenum mode); + + + // PrimitiveRestartIndex + void (GL_APIENTRY * glPrimitiveRestartIndex) ( GLuint index ); + + + // Mutlisample + bool isMultisampleSupported; + bool isMultisampleFilterHintSupported; + + void (GL_APIENTRY * glSampleCoverage) (GLclampf value, GLboolean invert); + + + // Point + bool isPointParametersSupported; + bool isPointSpriteSupported; + bool isPointSpriteCoordOriginSupported; + + void (GL_APIENTRY * glPointParameteri) (GLenum pname, GLint param); + void (GL_APIENTRY * glPointParameterf) (GLenum pname, GLfloat param); + void (GL_APIENTRY * glPointParameterfv) (GLenum pname, const GLfloat *params); + + + // FrameBuferObject + bool isFrameBufferObjectSupported; + bool isPackedDepthStencilSupported; + bool isRenderbufferMultisampleSupported() const { return glRenderbufferStorageMultisample != 0; } + bool isRenderbufferMultisampleCoverageSupported() const { return glRenderbufferStorageMultisampleCoverageNV != 0; } + + void (GL_APIENTRY * glBindRenderbuffer) (GLenum, GLuint); + void (GL_APIENTRY * glDeleteRenderbuffers) (GLsizei n, const GLuint *renderbuffers); + void (GL_APIENTRY * glGenRenderbuffers) (GLsizei, GLuint *); + void (GL_APIENTRY * glRenderbufferStorage) (GLenum, GLenum, GLsizei, GLsizei); + void (GL_APIENTRY * glRenderbufferStorageMultisample) (GLenum, GLsizei, GLenum, GLsizei, GLsizei); + void (GL_APIENTRY * glRenderbufferStorageMultisampleCoverageNV) (GLenum, GLsizei, GLsizei, GLenum, GLsizei, GLsizei); + void (GL_APIENTRY * glBindFramebuffer) (GLenum, GLuint); + void (GL_APIENTRY * glDeleteFramebuffers) (GLsizei n, const GLuint *framebuffers); + void (GL_APIENTRY * glGenFramebuffers) (GLsizei, GLuint *); + GLenum (GL_APIENTRY * glCheckFramebufferStatus) (GLenum); + + void (GL_APIENTRY * glFramebufferTexture1D) (GLenum, GLenum, GLenum, GLuint, GLint); + void (GL_APIENTRY * glFramebufferTexture2D) (GLenum, GLenum, GLenum, GLuint, GLint); + void (GL_APIENTRY * glFramebufferTexture3D) (GLenum, GLenum, GLenum, GLuint, GLint, GLint); + void (GL_APIENTRY * glFramebufferTexture) (GLenum, GLenum, GLint, GLint); + void (GL_APIENTRY * glFramebufferTextureLayer) (GLenum, GLenum, GLuint, GLint, GLint); + void (GL_APIENTRY * glFramebufferTextureFace)( GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face ); + void (GL_APIENTRY * glFramebufferRenderbuffer) (GLenum, GLenum, GLenum, GLuint); + + void (GL_APIENTRY * glGenerateMipmap) (GLenum); + void (GL_APIENTRY * glBlitFramebuffer) (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum); + void (GL_APIENTRY * glGetRenderbufferParameteriv) (GLenum, GLenum, GLint*); + + + // Sync + GLsync (GL_APIENTRY * glFenceSync) (GLenum condition, GLbitfield flags); + GLboolean (GL_APIENTRY * glIsSync) (GLsync sync); + void (GL_APIENTRY * glDeleteSync) (GLsync sync); + GLenum (GL_APIENTRY * glClientWaitSync) (GLsync sync, GLbitfield flags, GLuint64 timeout); + void (GL_APIENTRY * glWaitSync) (GLsync sync, GLbitfield flags, GLuint64 timeout); + void (GL_APIENTRY * glGetSynciv) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); + + +}; + + } #endif diff --git a/include/osg/PatchParameter b/include/osg/PatchParameter index 8e9d4712f..38606473a 100644 --- a/include/osg/PatchParameter +++ b/include/osg/PatchParameter @@ -17,7 +17,6 @@ #include #include #include -#include namespace osg { @@ -59,13 +58,13 @@ class OSG_EXPORT PatchParameter : public StateAttribute /** Get GL_PATCH_VERTICES parameter.*/ GLint getVertices() const { return _vertices; } - + /** Set GL_PATCH_DEFAULT_INNER_LEVEL parameter.*/ void setPatchDefaultInnerLevel(const osg::Vec2& level) { _patchDefaultInnerLevel = level; } /** Get GL_PATCH_DEFAULT_INNER_LEVEL parameter.*/ const osg::Vec2& getPatchDefaultInnerLevel() const { return _patchDefaultInnerLevel; } - + /** Set GL_PATCH_DEFAULT_OUTER_LEVEL parameter.*/ void setPatchDefaultOuterLevel(const osg::Vec4& level) { _patchDefaultOuterLevel = level; } diff --git a/include/osg/PrimitiveSet b/include/osg/PrimitiveSet index c96a95327..3c1156f2a 100644 --- a/include/osg/PrimitiveSet +++ b/include/osg/PrimitiveSet @@ -24,7 +24,6 @@ #include #include #include -#include #include diff --git a/include/osg/Program b/include/osg/Program index d899e05e9..7116570a5 100644 --- a/include/osg/Program +++ b/include/osg/Program @@ -331,7 +331,7 @@ class OSG_EXPORT Program : public osg::StateAttribute /** Pointer to our parent Program */ const Program* _program; /** Pointer to this context's extension functions */ - osg::ref_ptr _extensions; + osg::ref_ptr _extensions; /** Handle to the actual OpenGL glProgram */ GLuint _glProgramHandle; /** Does our glProgram need to be linked? */ @@ -342,7 +342,7 @@ class OSG_EXPORT Program : public osg::StateAttribute bool _loadedBinary; const unsigned int _contextID; - + /** Does the glProgram handle belongs to this class? */ bool _ownsProgramHandle; diff --git a/include/osg/Shader b/include/osg/Shader index 295d4c0a0..eeb2ba94c 100644 --- a/include/osg/Shader +++ b/include/osg/Shader @@ -22,7 +22,7 @@ #define OSG_SHADER 1 -#include +#include #include #include @@ -236,7 +236,7 @@ class OSG_EXPORT Shader : public osg::Object /** Pointer to our parent osg::Shader */ const Shader* _shader; /** Pointer to this context's extension functions. */ - osg::ref_ptr _extensions; + osg::ref_ptr _extensions; /** Handle to the actual glShader. */ GLuint _glShaderHandle; /** Does our glShader need to be recompiled? */ diff --git a/include/osg/State b/include/osg/State index e9b1499c2..7a15a106a 100644 --- a/include/osg/State +++ b/include/osg/State @@ -15,7 +15,7 @@ #define OSG_STATE 1 #include -#include +#include #include #include #include @@ -1941,7 +1941,7 @@ class OSG_EXPORT State : public Referenced DrawArraysInstancedProc _glDrawArraysInstanced; DrawElementsInstancedProc _glDrawElementsInstanced; - osg::ref_ptr _gl2Extentsions; + osg::ref_ptr _glExtensions; unsigned int _dynamicObjectCount; osg::ref_ptr _completeDynamicObjectRenderingCallback; @@ -2777,8 +2777,8 @@ inline bool State::setActiveTextureUnit( unsigned int unit ) } // forward declare speciailization of State::get() method -template<> inline GL2Extensions* State::get() { return _gl2Extentsions.get(); } -template<> inline const GL2Extensions* State::get() const { return _gl2Extentsions.get(); } +template<> inline GLExtensions* State::get() { return _glExtensions.get(); } +template<> inline const GLExtensions* State::get() const { return _glExtensions.get(); } } diff --git a/include/osg/Texture b/include/osg/Texture index 2513f7ccd..be5a33b62 100644 --- a/include/osg/Texture +++ b/include/osg/Texture @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/osg/TextureBuffer b/include/osg/TextureBuffer index 845358771..7130bdb37 100644 --- a/include/osg/TextureBuffer +++ b/include/osg/TextureBuffer @@ -121,7 +121,7 @@ class OSG_EXPORT TextureBuffer : public Texture _id(0), _usageHint(usageHint) { - _extensions = osg::GL2Extensions::Get(contextID, true); + _extensions = osg::GLExtensions::Get(contextID, true); } void bindBuffer(GLenum target); @@ -134,7 +134,7 @@ class OSG_EXPORT TextureBuffer : public Texture public: GLuint _id; GLenum _usageHint; - osg::GL2Extensions* _extensions; + osg::GLExtensions* _extensions; }; typedef osg::buffered_object > TextureBufferObjectList; diff --git a/include/osg/Uniform b/include/osg/Uniform index f7dbab4c1..6e880a924 100644 --- a/include/osg/Uniform +++ b/include/osg/Uniform @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include // for memset #include @@ -889,7 +889,7 @@ class OSG_EXPORT Uniform : public Object /** Get the number that the Uniform's name maps to uniquely */ unsigned int getNameID() const; - void apply(const GL2Extensions* ext, GLint location) const; + void apply(const GLExtensions* ext, GLint location) const; protected: diff --git a/include/osgViewer/Renderer b/include/osgViewer/Renderer index 9567d2b0e..f570fbe4a 100644 --- a/include/osgViewer/Renderer +++ b/include/osgViewer/Renderer @@ -35,7 +35,7 @@ class OSGVIEWER_EXPORT OpenGLQuerySupport : public osg::Referenced virtual void initialize(osg::State* state, osg::Timer_t startTick); protected: - const osg::GL2Extensions* _extensions; + const osg::GLExtensions* _extensions; }; class OSGVIEWER_EXPORT Renderer : public osg::GraphicsOperation diff --git a/src/osg/ArrayDispatchers.cpp b/src/osg/ArrayDispatchers.cpp index 7c07685c5..5d61952fa 100644 --- a/src/osg/ArrayDispatchers.cpp +++ b/src/osg/ArrayDispatchers.cpp @@ -196,7 +196,7 @@ void ArrayDispatchers::init() #ifdef OSG_GL_VERTEX_FUNCS_AVAILABLE - GL2Extensions* extensions = _state->get(); + GLExtensions* extensions = _state->get(); #ifndef OSG_GLES1_AVAILABLE _vertexDispatchers->assign(Array::Vec2ArrayType, glVertex2fv, 2); @@ -281,7 +281,7 @@ AttributeDispatch* ArrayDispatchers::vertexAttribDispatcher(unsigned int unit, A void ArrayDispatchers::assignTexCoordDispatchers(unsigned int unit) { #if defined(OSG_GL_VERTEX_FUNCS_AVAILABLE) && !defined(OSG_GLES1_AVAILABLE) - GL2Extensions* extensions = _state->get(); + GLExtensions* extensions = _state->get(); #endif for(unsigned int i=_texCoordDispatchers.size(); i<=unit; ++i) @@ -312,7 +312,7 @@ void ArrayDispatchers::assignTexCoordDispatchers(unsigned int unit) void ArrayDispatchers::assignVertexAttribDispatchers(unsigned int unit) { - GL2Extensions* extensions = _state->get(); + GLExtensions* extensions = _state->get(); for(unsigned int i=_vertexAttribDispatchers.size(); i<=unit; ++i) { diff --git a/src/osg/BlendColor.cpp b/src/osg/BlendColor.cpp index 879266311..e3223af3b 100644 --- a/src/osg/BlendColor.cpp +++ b/src/osg/BlendColor.cpp @@ -35,7 +35,7 @@ BlendColor::~BlendColor() void BlendColor::apply(State& state) const { - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if (!extensions->isBlendColorSupported) { OSG_WARN<<"Warning: BlendColor::apply(..) failed, BlendColor is not support by OpenGL driver."<(); + const GLExtensions* extensions = state.get(); if (!extensions->isBlendEquationSupported) { diff --git a/src/osg/BlendEquationi.cpp b/src/osg/BlendEquationi.cpp index e656d18d1..7bedb8aa4 100644 --- a/src/osg/BlendEquationi.cpp +++ b/src/osg/BlendEquationi.cpp @@ -28,7 +28,7 @@ BlendEquationi::~BlendEquationi() void BlendEquationi::apply(State& state) const { - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if (_equationRGB == _equationAlpha) { if (extensions->glBlendEquationi) diff --git a/src/osg/BlendFunc.cpp b/src/osg/BlendFunc.cpp index 7c07c67a8..b22788c50 100644 --- a/src/osg/BlendFunc.cpp +++ b/src/osg/BlendFunc.cpp @@ -50,7 +50,7 @@ void BlendFunc::apply(State& state) const if (_source_factor != _source_factor_alpha || _destination_factor != _destination_factor_alpha) { - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if (!extensions->isBlendFuncSeparateSupported) { OSG_WARN<<"Warning: BlendFunc::apply(..) failed, BlendFuncSeparate is not support by OpenGL driver, falling back to BlendFunc."<(); + const GLExtensions* extensions = state.get(); if (_source_factor != _source_factor_alpha || _destination_factor != _destination_factor_alpha) { diff --git a/src/osg/BufferObject.cpp b/src/osg/BufferObject.cpp index 6dc51ec4d..086d63ad1 100644 --- a/src/osg/BufferObject.cpp +++ b/src/osg/BufferObject.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include @@ -64,7 +64,7 @@ GLBufferObject::GLBufferObject(unsigned int contextID, BufferObject* bufferObjec { assign(bufferObject); - _extensions = GL2Extensions::Get(contextID, true); + _extensions = GLExtensions::Get(contextID, true); if (glObjectID==0) { @@ -1494,7 +1494,7 @@ void PixelDataBufferObject::bindBufferInWriteMode(State& state) //-------------------------------------------------------------------------------- void PixelDataBufferObject::unbindBuffer(unsigned int contextID) const { - GL2Extensions* extensions = GL2Extensions::Get(contextID, true); + GLExtensions* extensions = GLExtensions::Get(contextID, true); switch(_mode[contextID]) { diff --git a/src/osg/CMakeLists.txt b/src/osg/CMakeLists.txt index db3c6dbdd..759145b48 100644 --- a/src/osg/CMakeLists.txt +++ b/src/osg/CMakeLists.txt @@ -78,6 +78,7 @@ SET(TARGET_H ${HEADER_PATH}/Geode ${HEADER_PATH}/Geometry ${HEADER_PATH}/GL2Extensions + ${HEADER_PATH}/GLDefines ${HEADER_PATH}/GLExtensions ${HEADER_PATH}/GLBeginEndAdapter ${HEADER_PATH}/GLObjects diff --git a/src/osg/Capability.cpp b/src/osg/Capability.cpp index 1c3a508e4..53425bc7b 100644 --- a/src/osg/Capability.cpp +++ b/src/osg/Capability.cpp @@ -38,7 +38,7 @@ Capabilityi::~Capabilityi() void Enablei::apply(State& state) const { - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if (extensions->glEnablei) { OSG_INFO<<"extensions->glEnablei("<<_capability<<", "<<_index<<")"<(); + const GLExtensions* extensions = state.get(); if (extensions->glDisablei) { OSG_INFO<<"extensions->glDisablei("<<_capability<<", "<<_index<<")"<(); + const GLExtensions* extensions = state.get(); if (!extensions->isClampColorSupported) { OSG_WARN<<"Warning: ClampColor::apply(..) failed, ClampColor is not support by OpenGL driver."<(); + const GLExtensions* extensions = state.get(); if (extensions->glColorMaski) { extensions->glColorMaski((GLboolean)_index, (GLboolean)_red,(GLboolean)_green,(GLboolean)_blue,(GLboolean)_alpha); diff --git a/src/osg/FragmentProgram.cpp b/src/osg/FragmentProgram.cpp index d7f4d7502..c1e22df43 100644 --- a/src/osg/FragmentProgram.cpp +++ b/src/osg/FragmentProgram.cpp @@ -56,7 +56,7 @@ void FragmentProgram::flushDeletedFragmentProgramObjects(unsigned int contextID, { OpenThreads::ScopedLock lock(s_mutex_deletedFragmentProgramObjectCache); - const GL2Extensions* extensions = GL2Extensions::Get(contextID,true); + const GLExtensions* extensions = GLExtensions::Get(contextID,true); FragmentProgramObjectList& vpol = s_deletedFragmentProgramObjectCache[contextID]; @@ -127,7 +127,7 @@ void FragmentProgram::apply(State& state) const { #ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if (!extensions->isFragmentProgramSupported) return; diff --git a/src/osg/FrameBufferObject.cpp b/src/osg/FrameBufferObject.cpp index e708a7676..a043bf3be 100644 --- a/src/osg/FrameBufferObject.cpp +++ b/src/osg/FrameBufferObject.cpp @@ -59,7 +59,7 @@ void RenderBuffer::flushDeletedRenderBuffers(unsigned int contextID,double /*cur // if no time available don't try to flush objects. if (availableTime<=0.0) return; - const GL2Extensions* extensions = GL2Extensions::Get(contextID,true); + const GLExtensions* extensions = GLExtensions::Get(contextID,true); if(!extensions || !extensions->isFrameBufferObjectSupported ) return; const osg::Timer& timer = *osg::Timer::instance(); @@ -129,7 +129,7 @@ RenderBuffer::~RenderBuffer() } } -int RenderBuffer::getMaxSamples(unsigned int contextID, const GL2Extensions* ext) +int RenderBuffer::getMaxSamples(unsigned int contextID, const GLExtensions* ext) { static osg::buffered_value maxSamplesList; @@ -143,7 +143,7 @@ int RenderBuffer::getMaxSamples(unsigned int contextID, const GL2Extensions* ext return maxSamples; } -GLuint RenderBuffer::getObjectID(unsigned int contextID, const GL2Extensions* ext) const +GLuint RenderBuffer::getObjectID(unsigned int contextID, const GLExtensions* ext) const { GLuint &objectID = _objectID[contextID]; @@ -450,7 +450,7 @@ bool FrameBufferAttachment::isMultisample() const return false; } -void FrameBufferAttachment::createRequiredTexturesAndApplyGenerateMipMap(State &state, const GL2Extensions* ext) const +void FrameBufferAttachment::createRequiredTexturesAndApplyGenerateMipMap(State &state, const GLExtensions* ext) const { unsigned int contextID = state.getContextID(); @@ -481,7 +481,7 @@ void FrameBufferAttachment::createRequiredTexturesAndApplyGenerateMipMap(State & } } -void FrameBufferAttachment::attach(State &state, GLenum target, GLenum attachment_point, const GL2Extensions* ext) const +void FrameBufferAttachment::attach(State &state, GLenum target, GLenum attachment_point, const GLExtensions* ext) const { unsigned int contextID = state.getContextID(); @@ -641,7 +641,7 @@ void FrameBufferObject::flushDeletedFrameBufferObjects(unsigned int contextID,do // if no time available don't try to flush objects. if (availableTime<=0.0) return; - const GL2Extensions* extensions = GL2Extensions::Get(contextID,true); + const GLExtensions* extensions = GLExtensions::Get(contextID,true); if(!extensions || !extensions->isFrameBufferObjectSupported ) return; const osg::Timer& timer = *osg::Timer::instance(); @@ -772,7 +772,7 @@ void FrameBufferObject::apply(State &state, BindTarget target) const return; - GL2Extensions* ext = state.get(); + GLExtensions* ext = state.get(); if (!ext->isFrameBufferObjectSupported) { _unsupported[contextID] = 1; @@ -828,7 +828,7 @@ void FrameBufferObject::apply(State &state, BindTarget target) const { if (_drawBuffers.size() > 0) { - GL2Extensions *gl2e = state.get(); + GLExtensions *gl2e = state.get(); if (gl2e && gl2e->glDrawBuffers) { gl2e->glDrawBuffers(_drawBuffers.size(), &(_drawBuffers[0])); diff --git a/src/osg/GLExtensions.cpp b/src/osg/GLExtensions.cpp index 660286f2f..dd83bad38 100644 --- a/src/osg/GLExtensions.cpp +++ b/src/osg/GLExtensions.cpp @@ -51,6 +51,8 @@ #include #endif +using namespace osg; + typedef std::set ExtensionSet; static osg::buffered_object s_glExtensionSetList; static osg::buffered_object s_glRendererList; @@ -406,3 +408,745 @@ OSG_INIT_SINGLETON_PROXY(GLExtensionDisableStringInitializationProxy, osg::getGL #endif } #endif + +/////////////////////////////////////////////////////////////////////////// +// Static array of percontext osg::GLExtensions instances + +typedef osg::buffered_object< osg::ref_ptr > BufferedExtensions; +static BufferedExtensions s_extensions; + +GLExtensions* GLExtensions::Get(unsigned int contextID, bool createIfNotInitalized) +{ + if (!s_extensions[contextID] && createIfNotInitalized) + s_extensions[contextID] = new GLExtensions(contextID); + + return s_extensions[contextID].get(); +} + +void GLExtensions::Set(unsigned int contextID, GLExtensions* extensions) +{ + s_extensions[contextID] = extensions; +} + +/////////////////////////////////////////////////////////////////////////// +// Extension function pointers for OpenGL v2.x + +GLExtensions::GLExtensions(unsigned int contextID) +{ + const char* version = (const char*) glGetString( GL_VERSION ); + if (!version) + { + OSG_NOTIFY(osg::FATAL)<<"Error: OpenGL version test failed, requires valid graphics context."<=0;; + + + + isGlslSupported = ( glVersion >= 2.0f ) || + ( isShaderObjectsSupported && + isVertexShaderSupported && + isFragmentShaderSupported && + isLanguage100Supported ); + + if( isGlslSupported ) + { + // If glGetString raises an error, assume initial release "1.00" + while(glGetError() != GL_NO_ERROR) {} // reset error flag + + const char* langVerStr = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION); + if( (glGetError() == GL_NO_ERROR) && langVerStr ) + { + glslLanguageVersion = (findAsciiToFloat(langVerStr)); + } + else + glslLanguageVersion = 1.0f; + } + + OSG_INFO + << "glVersion=" << glVersion << ", " + << "isGlslSupported=" << (isGlslSupported ? "YES" : "NO") << ", " + << "glslLanguageVersion=" << glslLanguageVersion + << std::endl; + + + setGLExtensionFuncPtr(glDrawBuffers, "glDrawBuffers", "glDrawBuffersARB"); + setGLExtensionFuncPtr(glAttachShader, "glAttachShader", "glAttachObjectARB"); + setGLExtensionFuncPtr(glBindAttribLocation, "glBindAttribLocation", "glBindAttribLocationARB"); + setGLExtensionFuncPtr(glCompileShader, "glCompileShader", "glCompileShaderARB"); + setGLExtensionFuncPtr(glCreateProgram, "glCreateProgram", "glCreateProgramObjectARB"); + setGLExtensionFuncPtr(glCreateShader, "glCreateShader", "glCreateShaderObjectARB"); + setGLExtensionFuncPtr(glDeleteProgram, "glDeleteProgram"); + setGLExtensionFuncPtr(glDeleteShader, "glDeleteShader"); + setGLExtensionFuncPtr(glDetachShader, "glDetachShader", "glDetachObjectARB"); + setGLExtensionFuncPtr(glDisableVertexAttribArray, "glDisableVertexAttribArray"); + setGLExtensionFuncPtr(glEnableVertexAttribArray, "glEnableVertexAttribArray"); + setGLExtensionFuncPtr(glGetActiveAttrib, "glGetActiveAttrib", "glGetActiveAttribARB"); + setGLExtensionFuncPtr(glGetActiveUniform, "glGetActiveUniform", "glGetActiveUniformARB"); + setGLExtensionFuncPtr(glGetAttachedShaders, "glGetAttachedShaders", "glGetAttachedObjectsARB"); + setGLExtensionFuncPtr(glGetAttribLocation, "glGetAttribLocation", "glGetAttribLocationARB"); + setGLExtensionFuncPtr(glGetProgramiv, "glGetProgramiv"); + setGLExtensionFuncPtr(glGetProgramInfoLog, "glGetProgramInfoLog"); + setGLExtensionFuncPtr(glGetShaderiv, "glGetShaderiv"); + setGLExtensionFuncPtr(glGetShaderInfoLog, "glGetShaderInfoLog"); + setGLExtensionFuncPtr(glGetShaderSource, "glGetShaderSource", "glGetShaderSourceARB"); + setGLExtensionFuncPtr(glGetUniformLocation, "glGetUniformLocation", "glGetUniformLocationARB"); + setGLExtensionFuncPtr(glGetUniformfv, "glGetUniformfv", "glGetUniformfvARB"); + setGLExtensionFuncPtr(glGetUniformiv, "glGetUniformiv", "glGetUniformivARB"); + setGLExtensionFuncPtr(glGetVertexAttribdv, "glGetVertexAttribdv"); + setGLExtensionFuncPtr(glGetVertexAttribfv, "glGetVertexAttribfv"); + setGLExtensionFuncPtr(glGetVertexAttribiv, "glGetVertexAttribiv"); + setGLExtensionFuncPtr(glGetVertexAttribPointerv, "glGetVertexAttribPointerv"); + setGLExtensionFuncPtr(glIsProgram, "glIsProgram"); + setGLExtensionFuncPtr(glIsShader, "glIsShader"); + setGLExtensionFuncPtr(glLinkProgram, "glLinkProgram", "glLinkProgramARB"); + setGLExtensionFuncPtr(glShaderSource, "glShaderSource", "glShaderSourceARB"); + setGLExtensionFuncPtr(glUseProgram, "glUseProgram", "glUseProgramObjectARB"); + setGLExtensionFuncPtr(glUniform1f, "glUniform1f", "glUniform1fARB"); + setGLExtensionFuncPtr(glUniform2f, "glUniform2f", "glUniform2fARB"); + setGLExtensionFuncPtr(glUniform3f, "glUniform3f", "glUniform3fARB"); + setGLExtensionFuncPtr(glUniform4f, "glUniform4f", "glUniform4fARB"); + setGLExtensionFuncPtr(glUniform1i, "glUniform1i", "glUniform1iARB"); + setGLExtensionFuncPtr(glUniform2i, "glUniform2i", "glUniform2iARB"); + setGLExtensionFuncPtr(glUniform3i, "glUniform3i", "glUniform3iARB"); + setGLExtensionFuncPtr(glUniform4i, "glUniform4i", "glUniform4iARB"); + setGLExtensionFuncPtr(glUniform1fv, "glUniform1fv", "glUniform1fvARB"); + setGLExtensionFuncPtr(glUniform2fv, "glUniform2fv", "glUniform2fvARB"); + setGLExtensionFuncPtr(glUniform3fv, "glUniform3fv", "glUniform3fvARB"); + setGLExtensionFuncPtr(glUniform4fv, "glUniform4fv", "glUniform4fvARB"); + setGLExtensionFuncPtr(glUniform1iv, "glUniform1iv", "glUniform1ivARB"); + setGLExtensionFuncPtr(glUniform2iv, "glUniform2iv", "glUniform2ivARB"); + setGLExtensionFuncPtr(glUniform3iv, "glUniform3iv", "glUniform3ivARB"); + setGLExtensionFuncPtr(glUniform4iv, "glUniform4iv", "glUniform4ivARB"); + setGLExtensionFuncPtr(glUniformMatrix2fv, "glUniformMatrix2fv", "glUniformMatrix2fvARB"); + setGLExtensionFuncPtr(glUniformMatrix3fv, "glUniformMatrix3fv", "glUniformMatrix3fvARB"); + setGLExtensionFuncPtr(glUniformMatrix4fv, "glUniformMatrix4fv", "glUniformMatrix4fvARB"); + setGLExtensionFuncPtr(glValidateProgram, "glValidateProgram", "glValidateProgramARB"); + setGLExtensionFuncPtr(glVertexAttrib1d, "glVertexAttrib1d"); + setGLExtensionFuncPtr(glVertexAttrib1dv, "glVertexAttrib1dv"); + setGLExtensionFuncPtr(glVertexAttrib1f, "glVertexAttrib1f"); + setGLExtensionFuncPtr(glVertexAttrib1fv, "glVertexAttrib1fv"); + setGLExtensionFuncPtr(glVertexAttrib1s, "glVertexAttrib1s"); + setGLExtensionFuncPtr(glVertexAttrib1sv, "glVertexAttrib1sv"); + setGLExtensionFuncPtr(glVertexAttrib2d, "glVertexAttrib2d"); + setGLExtensionFuncPtr(glVertexAttrib2dv, "glVertexAttrib2dv"); + setGLExtensionFuncPtr(glVertexAttrib2f, "glVertexAttrib2f"); + setGLExtensionFuncPtr(glVertexAttrib2fv, "glVertexAttrib2fv"); + setGLExtensionFuncPtr(glVertexAttrib2s, "glVertexAttrib2s"); + setGLExtensionFuncPtr(glVertexAttrib2sv, "glVertexAttrib2sv"); + setGLExtensionFuncPtr(glVertexAttrib3d, "glVertexAttrib3d"); + setGLExtensionFuncPtr(glVertexAttrib3dv, "glVertexAttrib3dv"); + setGLExtensionFuncPtr(glVertexAttrib3f, "glVertexAttrib3f"); + setGLExtensionFuncPtr(glVertexAttrib3fv, "glVertexAttrib3fv"); + setGLExtensionFuncPtr(glVertexAttrib3s, "glVertexAttrib3s"); + setGLExtensionFuncPtr(glVertexAttrib3sv, "glVertexAttrib3sv"); + setGLExtensionFuncPtr(glVertexAttrib4Nbv, "glVertexAttrib4Nbv"); + setGLExtensionFuncPtr(glVertexAttrib4Niv, "glVertexAttrib4Niv"); + setGLExtensionFuncPtr(glVertexAttrib4Nsv, "glVertexAttrib4Nsv"); + setGLExtensionFuncPtr(glVertexAttrib4Nub, "glVertexAttrib4Nub"); + setGLExtensionFuncPtr(glVertexAttrib4Nubv, "glVertexAttrib4Nubv"); + setGLExtensionFuncPtr(glVertexAttrib4Nuiv, "glVertexAttrib4Nuiv"); + setGLExtensionFuncPtr(glVertexAttrib4Nusv, "glVertexAttrib4Nusv"); + setGLExtensionFuncPtr(glVertexAttrib4bv, "glVertexAttrib4bv"); + setGLExtensionFuncPtr(glVertexAttrib4d, "glVertexAttrib4d"); + setGLExtensionFuncPtr(glVertexAttrib4dv, "glVertexAttrib4dv"); + setGLExtensionFuncPtr(glVertexAttrib4f, "glVertexAttrib4f"); + setGLExtensionFuncPtr(glVertexAttrib4fv, "glVertexAttrib4fv"); + setGLExtensionFuncPtr(glVertexAttrib4iv, "glVertexAttrib4iv"); + setGLExtensionFuncPtr(glVertexAttrib4s, "glVertexAttrib4s"); + setGLExtensionFuncPtr(glVertexAttrib4sv, "glVertexAttrib4sv"); + setGLExtensionFuncPtr(glVertexAttrib4ubv, "glVertexAttrib4ubv"); + setGLExtensionFuncPtr(glVertexAttrib4uiv, "glVertexAttrib4uiv"); + setGLExtensionFuncPtr(glVertexAttrib4usv, "glVertexAttrib4usv"); + setGLExtensionFuncPtr(glVertexAttribPointer, "glVertexAttribPointer"); + setGLExtensionFuncPtr(glVertexAttribDivisor, "glVertexAttribDivisor"); + + // v1.5-only ARB entry points, in case they're needed for fallback + setGLExtensionFuncPtr(glGetInfoLogARB, "glGetInfoLogARB"); + setGLExtensionFuncPtr(glGetObjectParameterivARB, "glGetObjectParameterivARB"); + setGLExtensionFuncPtr(glDeleteObjectARB, "glDeleteObjectARB"); + setGLExtensionFuncPtr(glGetHandleARB, "glGetHandleARB"); + + // GL 2.1 + setGLExtensionFuncPtr(glUniformMatrix2x3fv, "glUniformMatrix2x3fv" ); + setGLExtensionFuncPtr(glUniformMatrix3x2fv, "glUniformMatrix3x2fv" ); + setGLExtensionFuncPtr(glUniformMatrix2x4fv, "glUniformMatrix2x4fv" ); + setGLExtensionFuncPtr(glUniformMatrix4x2fv, "glUniformMatrix4x2fv" ); + setGLExtensionFuncPtr(glUniformMatrix3x4fv, "glUniformMatrix3x4fv" ); + setGLExtensionFuncPtr(glUniformMatrix4x3fv, "glUniformMatrix4x3fv" ); + + // EXT_geometry_shader4 + setGLExtensionFuncPtr(glProgramParameteri, "glProgramParameteri", "glProgramParameteriEXT" ); + + // ARB_tesselation_shader + setGLExtensionFuncPtr(glPatchParameteri, "glPatchParameteri" ); + setGLExtensionFuncPtr(glPatchParameterfv, "glPatchParameterfv"); + + // EXT_gpu_shader4 + setGLExtensionFuncPtr(glGetUniformuiv, "glGetUniformuiv", "glGetUniformuivEXT" ); + setGLExtensionFuncPtr(glBindFragDataLocation, "glBindFragDataLocation", "glBindFragDataLocationEXT" ); + setGLExtensionFuncPtr(glGetFragDataLocation, "glGetFragDataLocation", "glGetFragDataLocationEXT" ); + setGLExtensionFuncPtr(glUniform1ui, "glUniform1ui", "glUniform1uiEXT" ); + setGLExtensionFuncPtr(glUniform2ui, "glUniform2ui", "glUniform2uiEXT" ); + setGLExtensionFuncPtr(glUniform3ui, "glUniform3ui", "glUniform3uiEXT" ); + setGLExtensionFuncPtr(glUniform4ui, "glUniform4ui", "glUniform4uiEXT" ); + setGLExtensionFuncPtr(glUniform1uiv, "glUniform1uiv", "glUniform1uivEXT" ); + setGLExtensionFuncPtr(glUniform2uiv, "glUniform2uiv", "glUniform2uivEXT" ); + setGLExtensionFuncPtr(glUniform3uiv, "glUniform3uiv", "glUniform3uivEXT" ); + setGLExtensionFuncPtr(glUniform4uiv, "glUniform4uiv", "glUniform4uivEXT" ); + // ARB_uniform_buffer_object + setGLExtensionFuncPtr(glGetUniformIndices, "glGetUniformIndices"); + setGLExtensionFuncPtr(glGetActiveUniformsiv, "glGetActiveUniformsiv"); + setGLExtensionFuncPtr(glGetActiveUniformName, "glGetActiveUniformName"); + setGLExtensionFuncPtr(glGetUniformBlockIndex, "glGetUniformBlockIndex"); + setGLExtensionFuncPtr(glGetActiveUniformBlockiv, "glGetActiveUniformBlockiv"); + setGLExtensionFuncPtr(glGetActiveUniformBlockName, "glGetActiveUniformBlockName"); + setGLExtensionFuncPtr(glUniformBlockBinding, "glUniformBlockBinding"); + + // ARB_get_program_binary + setGLExtensionFuncPtr(glGetProgramBinary, "glGetProgramBinary"); + setGLExtensionFuncPtr(glProgramBinary, "glProgramBinary"); + + // ARB_gpu_shader_fp64 + setGLExtensionFuncPtr(glUniform1d, "glUniform1d" ); + setGLExtensionFuncPtr(glUniform2d, "glUniform2d" ); + setGLExtensionFuncPtr(glUniform3d, "glUniform3d" ); + setGLExtensionFuncPtr(glUniform4d, "glUniform4d" ); + setGLExtensionFuncPtr(glUniform1dv, "glUniform1dv" ); + setGLExtensionFuncPtr(glUniform2dv, "glUniform2dv" ); + setGLExtensionFuncPtr(glUniform3dv, "glUniform3dv" ); + setGLExtensionFuncPtr(glUniform4dv, "glUniform4dv" ); + setGLExtensionFuncPtr(glUniformMatrix2dv, "glUniformMatrix2dv" ); + setGLExtensionFuncPtr(glUniformMatrix3dv, "glUniformMatrix3dv" ); + setGLExtensionFuncPtr(glUniformMatrix4dv, "glUniformMatrix4dv" ); + setGLExtensionFuncPtr(glUniformMatrix2x3dv, "glUniformMatrix2x3dv" ); + setGLExtensionFuncPtr(glUniformMatrix3x2dv, "glUniformMatrix3x2dv" ); + setGLExtensionFuncPtr(glUniformMatrix2x4dv, "glUniformMatrix2x4dv" ); + setGLExtensionFuncPtr(glUniformMatrix4x2dv, "glUniformMatrix4x2dv" ); + setGLExtensionFuncPtr(glUniformMatrix3x4dv, "glUniformMatrix3x4dv" ); + setGLExtensionFuncPtr(glUniformMatrix4x3dv, "glUniformMatrix4x3dv" ); + + // ARB_shader_atomic_counters + setGLExtensionFuncPtr(glGetActiveAtomicCounterBufferiv, "glGetActiveAtomicCounterBufferiv" ); + + // ARB_compute_shader + setGLExtensionFuncPtr(glDispatchCompute, "glDispatchCompute" ); + + setGLExtensionFuncPtr(glMemoryBarrier, "glMemoryBarrier", "glMemoryBarrierEXT" ); + + // BufferObject extensions + setGLExtensionFuncPtr(glGenBuffers, "glGenBuffers","glGenBuffersARB"); + setGLExtensionFuncPtr(glBindBuffer, "glBindBuffer","glBindBufferARB"); + setGLExtensionFuncPtr(glBufferData, "glBufferData","glBufferDataARB"); + setGLExtensionFuncPtr(glBufferSubData, "glBufferSubData","glBufferSubDataARB"); + setGLExtensionFuncPtr(glDeleteBuffers, "glDeleteBuffers","glDeleteBuffersARB"); + setGLExtensionFuncPtr(glIsBuffer, "glIsBuffer","glIsBufferARB"); + setGLExtensionFuncPtr(glGetBufferSubData, "glGetBufferSubData","glGetBufferSubDataARB"); + setGLExtensionFuncPtr(glMapBuffer, "glMapBuffer","glMapBufferARB"); + setGLExtensionFuncPtr(glMapBufferRange, "glMapBufferRange" ); + setGLExtensionFuncPtr(glUnmapBuffer, "glUnmapBuffer","glUnmapBufferARB"); + setGLExtensionFuncPtr(glGetBufferParameteriv, "glGetBufferParameteriv","glGetBufferParameterivARB"); + setGLExtensionFuncPtr(glGetBufferPointerv, "glGetBufferPointerv","glGetBufferPointervARB"); + setGLExtensionFuncPtr(glBindBufferRange, "glBindBufferRange"); + setGLExtensionFuncPtr(glBindBufferBase, "glBindBufferBase", "glBindBufferBaseEXT", "glBindBufferBaseNV" ); + setGLExtensionFuncPtr(glTexBuffer, "glTexBuffer","glTexBufferARB" ); + + isPBOSupported = OSG_GL3_FEATURES || osg::isGLExtensionSupported(contextID,"GL_ARB_pixel_buffer_object"); + isUniformBufferObjectSupported = osg::isGLExtensionSupported(contextID, "GL_ARB_uniform_buffer_object"); + isTBOSupported = osg::isGLExtensionSupported(contextID,"GL_ARB_texture_buffer_object"); + + + // BlendFunc extensions + isBlendFuncSeparateSupported = OSG_GLES2_FEATURES || OSG_GL3_FEATURES || + osg::isGLExtensionSupported(contextID, "GL_EXT_blend_func_separate") || + strncmp((const char*)glGetString(GL_VERSION), "1.4", 3) >= 0; + + setGLExtensionFuncPtr(glBlendFuncSeparate, "glBlendFuncSeparate", "glBlendFuncSeparateEXT"); + + setGLExtensionFuncPtr(glBlendFunci, "glBlendFunci", "glBlendFunciARB"); + setGLExtensionFuncPtr(glBlendFuncSeparatei, "glBlendFuncSeparatei", "glBlendFuncSeparateiARB"); + + + // Vertex Array extensions + isSecondaryColorSupported = isGLExtensionSupported(contextID,"GL_EXT_secondary_color"); + isFogCoordSupported = isGLExtensionSupported(contextID,"GL_EXT_fog_coord"); + isMultiTexSupported = isGLExtensionSupported(contextID,"GL_ARB_multitexture"); + isOcclusionQuerySupported = osg::isGLExtensionSupported(contextID, "GL_NV_occlusion_query" ); + isARBOcclusionQuerySupported = OSG_GL3_FEATURES || osg::isGLExtensionSupported(contextID, "GL_ARB_occlusion_query" ); + + isTimerQuerySupported = osg::isGLExtensionSupported(contextID, "GL_EXT_timer_query" ); + isARBTimerQuerySupported = osg::isGLExtensionSupported(contextID, "GL_ARB_timer_query"); + + setGLExtensionFuncPtr(glFogCoordfv, "glFogCoordfv","glFogCoordfvEXT"); + setGLExtensionFuncPtr(glSecondaryColor3ubv, "glSecondaryColor3ubv","glSecondaryColor3ubvEXT"); + setGLExtensionFuncPtr(glSecondaryColor3fv, "glSecondaryColor3fv","glSecondaryColor3fvEXT"); + setGLExtensionFuncPtr(glMultiTexCoord1f, "glMultiTexCoord1f","glMultiTexCoord1fARB"); + setGLExtensionFuncPtr(glMultiTexCoord1fv, "glMultiTexCoord1fv","glMultiTexCoord1fvARB"); + setGLExtensionFuncPtr(glMultiTexCoord2fv, "glMultiTexCoord2fv","glMultiTexCoord2fvARB"); + setGLExtensionFuncPtr(glMultiTexCoord3fv, "glMultiTexCoord3fv","glMultiTexCoord3fvARB"); + setGLExtensionFuncPtr(glMultiTexCoord4fv, "glMultiTexCoord4fv","glMultiTexCoord4fvARB"); + setGLExtensionFuncPtr(glMultiTexCoord1d, "glMultiTexCoord1d","glMultiTexCoorddfARB"); + setGLExtensionFuncPtr(glMultiTexCoord2dv, "glMultiTexCoord2dv","glMultiTexCoord2dvARB"); + setGLExtensionFuncPtr(glMultiTexCoord3dv, "glMultiTexCoord3dv","glMultiTexCoord3dvARB"); + setGLExtensionFuncPtr(glMultiTexCoord4dv, "glMultiTexCoord4dv","glMultiTexCoord4dvARB"); + + setGLExtensionFuncPtr(glVertexAttrib1s, "glVertexAttrib1s","glVertexAttrib1sARB"); + setGLExtensionFuncPtr(glVertexAttrib1f, "glVertexAttrib1f","glVertexAttrib1fARB"); + setGLExtensionFuncPtr(glVertexAttrib1d, "glVertexAttrib1d","glVertexAttrib1dARB"); + setGLExtensionFuncPtr(glVertexAttrib1fv, "glVertexAttrib1fv","glVertexAttrib1fvARB"); + setGLExtensionFuncPtr(glVertexAttrib2fv, "glVertexAttrib2fv","glVertexAttrib2fvARB"); + setGLExtensionFuncPtr(glVertexAttrib3fv, "glVertexAttrib3fv","glVertexAttrib3fvARB"); + setGLExtensionFuncPtr(glVertexAttrib4fv, "glVertexAttrib4fv","glVertexAttrib4fvARB"); + setGLExtensionFuncPtr(glVertexAttrib2dv, "glVertexAttrib2dv","glVertexAttrib2dvARB"); + setGLExtensionFuncPtr(glVertexAttrib3dv, "glVertexAttrib3dv","glVertexAttrib3dvARB"); + setGLExtensionFuncPtr(glVertexAttrib4dv, "glVertexAttrib4dv","glVertexAttrib4dvARB"); + setGLExtensionFuncPtr(glVertexAttrib4ubv, "glVertexAttrib4ubv","glVertexAttrib4ubvARB"); + setGLExtensionFuncPtr(glVertexAttrib4Nubv, "glVertexAttrib4Nubv","glVertexAttrib4NubvARB"); + + setGLExtensionFuncPtr(glGenBuffers, "glGenBuffers","glGenBuffersARB"); + setGLExtensionFuncPtr(glBindBuffer, "glBindBuffer","glBindBufferARB"); + setGLExtensionFuncPtr(glBufferData, "glBufferData","glBufferDataARB"); + setGLExtensionFuncPtr(glBufferSubData, "glBufferSubData","glBufferSubDataARB"); + setGLExtensionFuncPtr(glDeleteBuffers, "glDeleteBuffers","glDeleteBuffersARB"); + setGLExtensionFuncPtr(glIsBuffer, "glIsBuffer","glIsBufferARB"); + setGLExtensionFuncPtr(glGetBufferSubData, "glGetBufferSubData","glGetBufferSubDataARB"); + setGLExtensionFuncPtr(glMapBuffer, "glMapBuffer","glMapBufferARB"); + setGLExtensionFuncPtr(glUnmapBuffer, "glUnmapBuffer","glUnmapBufferARB"); + setGLExtensionFuncPtr(glGetBufferParameteriv, "glGetBufferParameteriv","glGetBufferParameterivARB"); + setGLExtensionFuncPtr(glGetBufferPointerv, "glGetBufferPointerv","glGetBufferPointervARB"); + + setGLExtensionFuncPtr(glGenOcclusionQueries, "glGenOcclusionQueries","glGenOcclusionQueriesNV"); + setGLExtensionFuncPtr(glDeleteOcclusionQueries, "glDeleteOcclusionQueries","glDeleteOcclusionQueriesNV"); + setGLExtensionFuncPtr(glIsOcclusionQuery, "glIsOcclusionQuery","_glIsOcclusionQueryNV"); + setGLExtensionFuncPtr(glBeginOcclusionQuery, "glBeginOcclusionQuery","glBeginOcclusionQueryNV"); + setGLExtensionFuncPtr(glEndOcclusionQuery, "glEndOcclusionQuery","glEndOcclusionQueryNV"); + setGLExtensionFuncPtr(glGetOcclusionQueryiv, "glGetOcclusionQueryiv","glGetOcclusionQueryivNV"); + setGLExtensionFuncPtr(glGetOcclusionQueryuiv, "glGetOcclusionQueryuiv","glGetOcclusionQueryuivNV"); + + setGLExtensionFuncPtr(glGenQueries, "glGenQueries", "glGenQueriesARB"); + setGLExtensionFuncPtr(glDeleteQueries, "glDeleteQueries", "glDeleteQueriesARB"); + setGLExtensionFuncPtr(glIsQuery, "glIsQuery", "glIsQueryARB"); + setGLExtensionFuncPtr(glBeginQuery, "glBeginQuery", "glBeginQueryARB"); + setGLExtensionFuncPtr(glEndQuery, "glEndQuery", "glEndQueryARB"); + setGLExtensionFuncPtr(glGetQueryiv, "glGetQueryiv", "glGetQueryivARB"); + setGLExtensionFuncPtr(glGetQueryObjectiv, "glGetQueryObjectiv","glGetQueryObjectivARB"); + setGLExtensionFuncPtr(glGetQueryObjectuiv, "glGetQueryObjectuiv","glGetQueryObjectuivARB"); + setGLExtensionFuncPtr(glGetQueryObjectui64v, "glGetQueryObjectui64v","glGetQueryObjectui64vEXT"); + setGLExtensionFuncPtr(glQueryCounter, "glQueryCounter"); + setGLExtensionFuncPtr(glGetInteger64v, "glGetInteger64v"); + + + // SampleMaski functionality + isTextureMultisampleSupported = isGLExtensionSupported(contextID, "GL_ARB_texture_multisample"); + isOpenGL32upported = getGLVersionNumber() >= 3.2; + + // function pointers + setGLExtensionFuncPtr(glSampleMaski, "glSampleMaski"); + // protect against buggy drivers (maybe not necessary) + isSampleMaskiSupported = glSampleMaski!=0; + + + + // old styple Vertex/Fragment Programs + isVertexProgramSupported = isGLExtensionSupported(contextID,"GL_ARB_vertex_program"); + isFragmentProgramSupported = isGLExtensionSupported(contextID,"GL_ARB_fragment_program"); + + setGLExtensionFuncPtr(glBindProgram,"glBindProgramARB"); + setGLExtensionFuncPtr(glGenPrograms, "glGenProgramsARB"); + setGLExtensionFuncPtr(glDeletePrograms, "glDeleteProgramsARB"); + setGLExtensionFuncPtr(glProgramString, "glProgramStringARB"); + setGLExtensionFuncPtr(glProgramLocalParameter4fv, "glProgramLocalParameter4fvARB"); + + + + // Texture extensions + const char* renderer = (const char*) glGetString(GL_RENDERER); + std::string rendererString(renderer ? renderer : ""); + + bool radeonHardwareDetected = (rendererString.find("Radeon")!=std::string::npos || rendererString.find("RADEON")!=std::string::npos); + bool fireGLHardwareDetected = (rendererString.find("FireGL")!=std::string::npos || rendererString.find("FIREGL")!=std::string::npos); + + bool builtInSupport = OSG_GLES2_FEATURES || OSG_GL3_FEATURES; + + isMultiTexturingSupported = builtInSupport || OSG_GLES1_FEATURES || + isGLExtensionOrVersionSupported( contextID,"GL_ARB_multitexture", 1.3f) || + isGLExtensionOrVersionSupported(contextID,"GL_EXT_multitexture", 1.3f); + + isTextureFilterAnisotropicSupported = isGLExtensionSupported(contextID,"GL_EXT_texture_filter_anisotropic"); + isTextureSwizzleSupported = isGLExtensionSupported(contextID,"GL_ARB_texture_swizzle"); + isTextureCompressionARBSupported = builtInSupport || isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_compression", 1.3f); + isTextureCompressionS3TCSupported = isGLExtensionSupported(contextID,"GL_EXT_texture_compression_s3tc"); + isTextureCompressionPVRTC2BPPSupported = isGLExtensionSupported(contextID,"GL_IMG_texture_compression_pvrtc"); + isTextureCompressionPVRTC4BPPSupported = isTextureCompressionPVRTC2BPPSupported;//covered by same extension + isTextureCompressionETCSupported = isGLExtensionSupported(contextID,"GL_OES_compressed_ETC1_RGB8_texture"); + isTextureCompressionETC2Supported = isGLExtensionSupported(contextID,"GL_ARB_ES3_compatibility"); + isTextureCompressionRGTCSupported = isGLExtensionSupported(contextID,"GL_EXT_texture_compression_rgtc"); + isTextureCompressionPVRTCSupported = isGLExtensionSupported(contextID,"GL_IMG_texture_compression_pvrtc"); + + isTextureMirroredRepeatSupported = builtInSupport || + isGLExtensionOrVersionSupported(contextID,"GL_IBM_texture_mirrored_repeat", 1.4f) || + isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_mirrored_repeat", 1.4f); + + isTextureEdgeClampSupported = builtInSupport || + isGLExtensionOrVersionSupported(contextID,"GL_EXT_texture_edge_clamp", 1.2f) || + isGLExtensionOrVersionSupported(contextID,"GL_SGIS_texture_edge_clamp", 1.2f); + + + isTextureBorderClampSupported = OSG_GL3_FEATURES || ((OSG_GL1_FEATURES || OSG_GL2_FEATURES) && isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_border_clamp", 1.3f)); + isGenerateMipMapSupported = builtInSupport || isGLExtensionOrVersionSupported(contextID,"GL_SGIS_generate_mipmap", 1.4f); + preferGenerateMipmapSGISForPowerOfTwo = (radeonHardwareDetected||fireGLHardwareDetected) ? false : true; + isTextureMultisampledSupported = isGLExtensionSupported(contextID,"GL_ARB_texture_multisample"); + isShadowSupported = OSG_GL3_FEATURES || isGLExtensionSupported(contextID,"GL_ARB_shadow"); + isShadowAmbientSupported = isGLExtensionSupported(contextID,"GL_ARB_shadow_ambient"); + isClientStorageSupported = isGLExtensionSupported(contextID,"GL_APPLE_client_storage"); + isNonPowerOfTwoTextureNonMipMappedSupported = builtInSupport || isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_non_power_of_two", 2.0) || isGLExtensionSupported(contextID,"GL_APPLE_texture_2D_limited_npot"); + isNonPowerOfTwoTextureMipMappedSupported = builtInSupport || isNonPowerOfTwoTextureNonMipMappedSupported; + isTextureIntegerEXTSupported = OSG_GL3_FEATURES || isGLExtensionSupported(contextID, "GL_EXT_texture_integer"); + + if (rendererString.find("GeForce FX")!=std::string::npos) + { + isNonPowerOfTwoTextureMipMappedSupported = false; + OSG_INFO<<"Disabling _isNonPowerOfTwoTextureMipMappedSupported for GeForce FX hardware."<= 1.2f ); + + isTextureStorageEnabled = isTexStorage2DSupported(); + if ( (ptr = getenv("OSG_GL_TEXTURE_STORAGE")) != 0 && isTexStorage2DSupported()) + { + if (strcmp(ptr,"OFF")==0 || strcmp(ptr,"DISABLE")==0 ) isTextureStorageEnabled = false; + else isTextureStorageEnabled = true; + } + + + // Texture3D extensions + isTexture3DFast = OSG_GL3_FEATURES || isGLExtensionSupported(contextID,"GL_EXT_texture3D"); + + if (isTexture3DFast) isTexture3DSupported = true; + else isTexture3DSupported = strncmp((const char*)glGetString(GL_VERSION),"1.2",3)>=0; + + maxTexture3DSize = 0; + glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &maxTexture3DSize); + + setGLExtensionFuncPtr(glTexImage3D, "glTexImage3D","glTexImage3DEXT"); + setGLExtensionFuncPtr(glTexSubImage3D, "glTexSubImage3D","glTexSubImage3DEXT"); + setGLExtensionFuncPtr(glCompressedTexImage3D, "glCompressedTexImage3D","glCompressedTexImage3DARB"); + setGLExtensionFuncPtr(glCompressedTexSubImage3D, "glCompressedTexSubImage3D","glCompressedTexSubImage3DARB"); + setGLExtensionFuncPtr(glCopyTexSubImage3D, "glCopyTexSubImage3D","glCopyTexSubImage3DEXT"); + + + // Texture2DArray extensions + isTexture2DArraySupported = OSG_GL3_FEATURES || isGLExtensionSupported(contextID,"GL_EXT_texture_array"); + + max2DSize = 0; + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max2DSize); + maxLayerCount = 0; + glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS_EXT, &maxLayerCount); + + // Blending + isBlendColorSupported = OSG_GLES2_FEATURES || OSG_GL3_FEATURES || + isGLExtensionSupported(contextID,"GL_EXT_blend_color") || + strncmp((const char*)glGetString(GL_VERSION),"1.2",3)>=0; + + setGLExtensionFuncPtr(glBlendColor, "glBlendColor", "glBlendColorEXT"); + + bool bultInSupport = OSG_GLES2_FEATURES || OSG_GL3_FEATURES; + isBlendEquationSupported = bultInSupport || + isGLExtensionSupported(contextID, "GL_EXT_blend_equation") || + strncmp((const char*)glGetString(GL_VERSION), "1.2", 3) >= 0; + + + isBlendEquationSeparateSupported = bultInSupport || + isGLExtensionSupported(contextID, "GL_EXT_blend_equation_separate") || + strncmp((const char*)glGetString(GL_VERSION), "2.0", 3) >= 0; + + + isSGIXMinMaxSupported = isGLExtensionSupported(contextID, "GL_SGIX_blend_alpha_minmax"); + isLogicOpSupported = isGLExtensionSupported(contextID, "GL_EXT_blend_logic_op"); + + setGLExtensionFuncPtr(glBlendEquation, "glBlendEquation", "glBlendEquationEXT"); + setGLExtensionFuncPtr(glBlendEquationSeparate, "glBlendEquationSeparate", "glBlendEquationSeparateEXT"); + + setGLExtensionFuncPtr(glBlendEquationi, "glBlendEquationi", "glBlendEquationiARB"); + setGLExtensionFuncPtr(glBlendEquationSeparatei, "glBlendEquationSeparatei", "glBlendEquationSeparateiARB"); + + + // glEnablei/glDisabli + setGLExtensionFuncPtr(glEnablei, "glEnablei"); + setGLExtensionFuncPtr(glDisablei, "glDisablei"); + + + // Stencil` + isStencilWrapSupported = isGLExtensionOrVersionSupported(contextID, "GL_EXT_stencil_wrap", 1.4f); + isStencilTwoSidedSupported = isGLExtensionSupported(contextID, "GL_EXT_stencil_two_side"); + isOpenGL20Supported = getGLVersionNumber() >= 2.0; + isSeparateStencilSupported = isGLExtensionSupported(contextID, "GL_ATI_separate_stencil"); + + // function pointers + setGLExtensionFuncPtr(glActiveStencilFace, "glActiveStencilFaceEXT"); + setGLExtensionFuncPtr(glStencilOpSeparate, "glStencilOpSeparate", "glStencilOpSeparateATI"); + setGLExtensionFuncPtr(glStencilMaskSeparate, "glStencilMaskSeparate"); + setGLExtensionFuncPtr(glStencilFuncSeparate, "glStencilFuncSeparate", "glStencilFuncSeparateATI"); + setGLExtensionFuncPtr(glStencilFuncSeparateATI, "glStencilFuncSeparateATI"); + + + // Color Mask + setGLExtensionFuncPtr(glColorMaski, "glColorMaski", "glColorMaskiARB"); + + + // ClampColor + isClampColorSupported = OSG_GL3_FEATURES || + isGLExtensionSupported(contextID,"GL_ARB_color_buffer_float") || + strncmp((const char*)glGetString(GL_VERSION),"2.0",3)>=0; + + setGLExtensionFuncPtr(glClampColor, "glClampColor", "glClampColorARB"); + + + // PrimitiveRestartIndex + setGLExtensionFuncPtr(glPrimitiveRestartIndex, "glPrimitiveRestartIndex", "glPrimitiveRestartIndexNV"); + + + // Point + isPointParametersSupported = OSG_GL3_FEATURES || + strncmp((const char*)glGetString(GL_VERSION),"1.4",3)>=0 || + isGLExtensionSupported(contextID,"GL_ARB_point_parameters") || + isGLExtensionSupported(contextID,"GL_EXT_point_parameters") || + isGLExtensionSupported(contextID,"GL_SGIS_point_parameters"); + + + isPointSpriteSupported = OSG_GL3_FEATURES || isGLExtensionSupported(contextID, "GL_ARB_point_sprite") || isGLExtensionSupported(contextID, "GL_OES_point_sprite") || isGLExtensionSupported(contextID, "GL_NV_point_sprite"); + isPointSpriteCoordOriginSupported = OSG_GL3_FEATURES || strncmp((const char*)glGetString(GL_VERSION),"2.0",3)>=0; + + + setGLExtensionFuncPtr(glPointParameteri, "glPointParameteri", "glPointParameteriARB"); + if (!glPointParameteri) setGLExtensionFuncPtr(glPointParameteri, "glPointParameteriEXT", "glPointParameteriSGIS"); + + setGLExtensionFuncPtr(glPointParameterf, "glPointParameterf", "glPointParameterfARB"); + if (!glPointParameterf) setGLExtensionFuncPtr(glPointParameterf, "glPointParameterfEXT", "glPointParameterfSGIS"); + + setGLExtensionFuncPtr(glPointParameterfv, "glPointParameterfv", "glPointParameterfvARB"); + if (!glPointParameterfv) setGLExtensionFuncPtr(glPointParameterfv, "glPointParameterfvEXT", "glPointParameterfvSGIS"); + + + // Multisample + isMultisampleSupported = OSG_GLES2_FEATURES || OSG_GL3_FEATURES || isGLExtensionSupported(contextID,"GL_ARB_multisample"); + isMultisampleFilterHintSupported = isGLExtensionSupported(contextID, "GL_NV_multisample_filter_hint"); + + setGLExtensionFuncPtr(glSampleCoverage, "glSampleCoverageARB"); + + + // FrameBufferObject + setGLExtensionFuncPtr(glBindRenderbuffer, "glBindRenderbuffer", "glBindRenderbufferEXT", "glBindRenderbufferOES"); + setGLExtensionFuncPtr(glDeleteRenderbuffers, "glDeleteRenderbuffers", "glDeleteRenderbuffersEXT", "glDeleteRenderbuffersOES"); + setGLExtensionFuncPtr(glGenRenderbuffers, "glGenRenderbuffers", "glGenRenderbuffersEXT", "glGenRenderbuffersOES"); + setGLExtensionFuncPtr(glRenderbufferStorage, "glRenderbufferStorage", "glRenderbufferStorageEXT", "glRenderbufferStorageOES"); + setGLExtensionFuncPtr(glRenderbufferStorageMultisample, "glRenderbufferStorageMultisample", "glRenderbufferStorageMultisampleEXT", "glRenderbufferStorageMultisampleOES"); + setGLExtensionFuncPtr(glRenderbufferStorageMultisampleCoverageNV, "glRenderbufferStorageMultisampleCoverageNV"); + setGLExtensionFuncPtr(glBindFramebuffer, "glBindFramebuffer", "glBindFramebufferEXT", "glBindFramebufferOES"); + setGLExtensionFuncPtr(glDeleteFramebuffers, "glDeleteFramebuffers", "glDeleteFramebuffersEXT", "glDeleteFramebuffersOES"); + setGLExtensionFuncPtr(glGenFramebuffers, "glGenFramebuffers", "glGenFramebuffersEXT", "glGenFramebuffersOES"); + setGLExtensionFuncPtr(glCheckFramebufferStatus, "glCheckFramebufferStatus", "glCheckFramebufferStatusEXT", "glCheckFramebufferStatusOES"); + + setGLExtensionFuncPtr(glFramebufferTexture1D, "glFramebufferTexture1D", "glFramebufferTexture1DEXT", "glFramebufferTexture1DOES"); + setGLExtensionFuncPtr(glFramebufferTexture2D, "glFramebufferTexture2D", "glFramebufferTexture2DEXT", "glFramebufferTexture2DOES"); + setGLExtensionFuncPtr(glFramebufferTexture3D, "glFramebufferTexture3D", "glFramebufferTexture3DEXT", "glFramebufferTexture3DOES"); + setGLExtensionFuncPtr(glFramebufferTexture, "glFramebufferTexture", "glFramebufferTextureEXT", "glFramebufferTextureOES"); + setGLExtensionFuncPtr(glFramebufferTextureLayer, "glFramebufferTextureLayer", "glFramebufferTextureLayerEXT", "glFramebufferTextureLayerOES"); + setGLExtensionFuncPtr(glFramebufferTextureFace, "glFramebufferTextureFace", "glFramebufferTextureFaceEXT", "glFramebufferTextureFaceOES" ); + setGLExtensionFuncPtr(glFramebufferRenderbuffer, "glFramebufferRenderbuffer", "glFramebufferRenderbufferEXT", "glFramebufferRenderbufferOES"); + + setGLExtensionFuncPtr(glGenerateMipmap, "glGenerateMipmap", "glGenerateMipmapEXT", "glGenerateMipmapOES"); + setGLExtensionFuncPtr(glBlitFramebuffer, "glBlitFramebuffer", "glBlitFramebufferEXT", "glBlitFramebufferOES"); + setGLExtensionFuncPtr(glGetRenderbufferParameteriv, "glGetRenderbufferParameteriv", "glGetRenderbufferParameterivEXT", "glGetRenderbufferParameterivOES"); + + isFrameBufferObjectSupported = + glBindRenderbuffer != 0 && + glDeleteRenderbuffers != 0 && + glGenRenderbuffers != 0 && + glRenderbufferStorage != 0 && + glBindFramebuffer != 0 && + glDeleteFramebuffers != 0 && + glGenFramebuffers != 0 && + glCheckFramebufferStatus != 0 && + glFramebufferTexture2D != 0 && + glFramebufferRenderbuffer != 0 && + glGenerateMipmap != 0 && + glGetRenderbufferParameteriv != 0; + + isPackedDepthStencilSupported = OSG_GL3_FEATURES || + (isGLExtensionSupported(contextID, "GL_EXT_packed_depth_stencil")) || + (isGLExtensionSupported(contextID, "GL_OES_packed_depth_stencil")); + + + // Sync + osg::setGLExtensionFuncPtr(glFenceSync, "glFenceSync"); + osg::setGLExtensionFuncPtr(glIsSync, "glIsSync"); + osg::setGLExtensionFuncPtr(glDeleteSync, "glDeleteSync"); + osg::setGLExtensionFuncPtr(glClientWaitSync, "glClientWaitSync"); + osg::setGLExtensionFuncPtr(glWaitSync, "glWaitSync"); + osg::setGLExtensionFuncPtr(glGetSynciv, "glGetSynciv"); + +} + + + +/////////////////////////////////////////////////////////////////////////// +// C++-friendly convenience methods + +GLuint GLExtensions::getCurrentProgram() const +{ + if( glVersion >= 2.0f ) + { + // GLSL as GL v2.0 core functionality + GLint result = 0; + glGetIntegerv( GL_CURRENT_PROGRAM, &result ); + return static_cast(result); + } + else if (glGetHandleARB) + { + // fallback for GLSL as GL v1.5 ARB extension +#ifndef GL_PROGRAM_OBJECT_ARB +#define GL_PROGRAM_OBJECT_ARB 0x8B40 +#endif + return glGetHandleARB( GL_PROGRAM_OBJECT_ARB ); + } + else + { + OSG_WARN<<"Warning GLExtensions::getCurrentProgram not supported"< 1 ) + { + GLchar* infoLog = new GLchar[bufLen]; + glGetProgramInfoLog( program, bufLen, &strLen, infoLog ); + if( strLen > 0 ) result = reinterpret_cast(infoLog); + delete [] infoLog; + } + return (strLen > 0); +} + + +bool GLExtensions::getShaderInfoLog( GLuint shader, std::string& result ) const +{ + GLsizei bufLen = 0; // length of buffer to allocate + GLsizei strLen = 0; // strlen GL actually wrote to buffer + + glGetShaderiv( shader, GL_INFO_LOG_LENGTH, &bufLen ); + if( bufLen > 1 ) + { + GLchar* infoLog = new GLchar[bufLen]; + glGetShaderInfoLog( shader, bufLen, &strLen, infoLog ); + if( strLen > 0 ) result = reinterpret_cast(infoLog); + delete [] infoLog; + } + return (strLen > 0); +} + + +bool GLExtensions::getAttribLocation( const char* attribName, GLuint& location ) const +{ + // is there an active GLSL program? + GLuint program = getCurrentProgram(); + if( glIsProgram(program) == GL_FALSE ) return false; + + // has that program been successfully linked? + GLint linked = GL_FALSE; + glGetProgramiv( program, GL_LINK_STATUS, &linked ); + if( linked == GL_FALSE ) return false; + + // is there such a named attribute? + GLint loc = glGetAttribLocation( program, reinterpret_cast(attribName) ); + if( loc < 0 ) return false; + + location = loc; + return true; +} + + +bool GLExtensions::getFragDataLocation( const char* fragDataName, GLuint& location ) const +{ + // is there an active GLSL program? + GLuint program = getCurrentProgram(); + if( glIsProgram(program) == GL_FALSE ) return false; + + // has that program been successfully linked? + GLint linked = GL_FALSE; + glGetProgramiv( program, GL_LINK_STATUS, &linked ); + if( linked == GL_FALSE ) return false; + + // check if supported + if (glGetFragDataLocation == NULL) return false; + + // is there such a named attribute? + GLint loc = glGetFragDataLocation( program, reinterpret_cast(fragDataName) ); + if( loc < 0 ) return false; + + location = loc; + return true; +} + diff --git a/src/osg/Geometry.cpp b/src/osg/Geometry.cpp index b5f9af1ec..ef6f84bc5 100644 --- a/src/osg/Geometry.cpp +++ b/src/osg/Geometry.cpp @@ -661,7 +661,7 @@ void Geometry::compileGLObjects(RenderInfo& renderInfo) const { State& state = *renderInfo.getState(); unsigned int contextID = state.getContextID(); - GL2Extensions* extensions = state.get(); + GLExtensions* extensions = state.get(); if (!extensions) return; typedef std::set BufferObjects; diff --git a/src/osg/GraphicsContext.cpp b/src/osg/GraphicsContext.cpp index b1dbd7eff..486ff59fe 100644 --- a/src/osg/GraphicsContext.cpp +++ b/src/osg/GraphicsContext.cpp @@ -993,7 +993,7 @@ void SyncSwapBuffersCallback::swapBuffersImplementation(osg::GraphicsContext* gc gc->swapBuffersImplementation(); //glFinish(); - GL2Extensions* ext = gc->getState()->get(); + GLExtensions* ext = gc->getState()->get(); if (ext->glClientWaitSync) { diff --git a/src/osg/Image.cpp b/src/osg/Image.cpp index 7b95e6c00..068797c4f 100644 --- a/src/osg/Image.cpp +++ b/src/osg/Image.cpp @@ -1053,7 +1053,7 @@ void Image::readImageFromCurrentTexture(unsigned int contextID, bool copyMipMaps #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) // OSG_NOTICE<<"Image::readImageFromCurrentTexture()"<(); + const GLExtensions* extensions = state.get(); if (!extensions->isMultisampleSupported) { OSG_WARN<<"Warning: Multisample::apply(..) failed, Multisample is not support by OpenGL driver."< ResultsVector; ResultsVector _results; - RetrieveQueriesCallback( osg::GL2Extensions* ext=NULL ) + RetrieveQueriesCallback( osg::GLExtensions* ext=NULL ) : _extensionsFallback( ext ) { } @@ -118,24 +118,24 @@ struct RetrieveQueriesCallback : public osg::Camera::DrawCallback double elapsedTime( 0. ); int count( 0 ); - const osg::GL2Extensions* ext=0; + const osg::GLExtensions* 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. - ext = camera.getGraphicsContext()->getState()->get(); + ext = camera.getGraphicsContext()->getState()->get(); } else { // No valid GraphicsContext in the Camera. This might happen in // SceneView-based apps. Rely on the creating code to have passed - // in a valid GL2Extensions pointer, and hope it's valid for any + // in a valid GLExtensions pointer, and hope it's valid for any // context that might be current. - OSG_DEBUG << "osgOQ: RQCB: Using fallback path to obtain GL2Extensions pointer." << std::endl; + OSG_DEBUG << "osgOQ: RQCB: Using fallback path to obtain GLExtensions pointer." << std::endl; ext = _extensionsFallback; if (!ext) { - OSG_FATAL << "osgOQ: RQCB: GL2Extensions pointer fallback is NULL." << std::endl; + OSG_FATAL << "osgOQ: RQCB: GLExtensions pointer fallback is NULL." << std::endl; return; } } @@ -204,7 +204,7 @@ struct RetrieveQueriesCallback : public osg::Camera::DrawCallback _results.push_back( tr ); } - osg::GL2Extensions* _extensionsFallback; + osg::GLExtensions* _extensionsFallback; }; @@ -279,7 +279,7 @@ void QueryGeometry::drawImplementation( osg::RenderInfo& renderInfo ) const { unsigned int contextID = renderInfo.getState()->getContextID(); - osg::GL2Extensions* ext = renderInfo.getState()->get(); + osg::GLExtensions* ext = renderInfo.getState()->get(); osg::Camera* cam = renderInfo.getCurrentCamera(); // Add callbacks if necessary. @@ -412,7 +412,7 @@ QueryGeometry::flushDeletedQueryObjects( unsigned int contextID, double /*curren { OpenThreads::ScopedLock lock(s_mutex_deletedQueryObjectCache); - const osg::GL2Extensions* extensions = osg::GL2Extensions::Get( contextID, true ); + const osg::GLExtensions* extensions = osg::GLExtensions::Get( contextID, true ); QueryObjectList& qol = s_deletedQueryObjectCache[contextID]; diff --git a/src/osg/PatchParameter.cpp b/src/osg/PatchParameter.cpp index 25d62ac78..ca733c8fd 100644 --- a/src/osg/PatchParameter.cpp +++ b/src/osg/PatchParameter.cpp @@ -31,7 +31,7 @@ PatchParameter::~PatchParameter() void PatchParameter::apply(State& state) const { - GL2Extensions* extensions = state.get(); + GLExtensions* extensions = state.get(); if (extensions->areTessellationShadersSupported ) { diff --git a/src/osg/Point.cpp b/src/osg/Point.cpp index d38769bcf..920d18bb3 100644 --- a/src/osg/Point.cpp +++ b/src/osg/Point.cpp @@ -84,7 +84,7 @@ void Point::apply(State& state) const #ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE glPointSize(_size); - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if (!extensions->isPointParametersSupported) return; diff --git a/src/osg/PointSprite.cpp b/src/osg/PointSprite.cpp index 97f191f41..2a2e03394 100644 --- a/src/osg/PointSprite.cpp +++ b/src/osg/PointSprite.cpp @@ -42,7 +42,7 @@ int PointSprite::compare(const StateAttribute& sa) const bool PointSprite::checkValidityOfAssociatedModes(osg::State& state) const { - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); bool modeValid = extensions->isPointSpriteSupported; #if defined( OSG_GLES1_AVAILABLE ) //point sprites don't exist on es 2.0 @@ -56,7 +56,7 @@ bool PointSprite::checkValidityOfAssociatedModes(osg::State& state) const void PointSprite::apply(osg::State& state) const { - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); #if defined( OSG_GL3_AVAILABLE ) extensions->glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, _coordOriginMode); diff --git a/src/osg/PrimitiveRestartIndex.cpp b/src/osg/PrimitiveRestartIndex.cpp index 3240f073a..474129a3a 100644 --- a/src/osg/PrimitiveRestartIndex.cpp +++ b/src/osg/PrimitiveRestartIndex.cpp @@ -52,7 +52,7 @@ int PrimitiveRestartIndex::compare(const StateAttribute& sa) const void PrimitiveRestartIndex::apply(State& state) const { // get "per-context" extensions - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if (extensions->glPrimitiveRestartIndex) { extensions->glPrimitiveRestartIndex( _restartIndex ); diff --git a/src/osg/Program.cpp b/src/osg/Program.cpp index b241ff2e5..99a1703de 100644 --- a/src/osg/Program.cpp +++ b/src/osg/Program.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include @@ -66,7 +66,7 @@ void Program::flushDeletedGlPrograms(unsigned int contextID,double /*currentTime if (availableTime<=0.0) return; OpenThreads::ScopedLock lock(s_mutex_deletedGlProgramCache); - const GL2Extensions* extensions = GL2Extensions::Get(contextID,true); + const GLExtensions* extensions = GLExtensions::Get(contextID,true); if( ! extensions->isGlslSupported ) return; const osg::Timer& timer = *osg::Timer::instance(); @@ -441,7 +441,7 @@ void Program::removeBindUniformBlock(const std::string& name) void Program::apply( osg::State& state ) const { const unsigned int contextID = state.getContextID(); - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if( ! extensions->isGlslSupported ) return; if( isFixedFunction() ) @@ -534,7 +534,7 @@ Program::PerContextProgram::PerContextProgram(const Program* program, unsigned i _program = program; if (_glProgramHandle == 0) { - _extensions = GL2Extensions::Get( _contextID, true ); + _extensions = GLExtensions::Get( _contextID, true ); _glProgramHandle = _extensions->glCreateProgram(); _ownsProgramHandle = true; } diff --git a/src/osg/SampleMaski.cpp b/src/osg/SampleMaski.cpp index dd471d801..705f8a99e 100644 --- a/src/osg/SampleMaski.cpp +++ b/src/osg/SampleMaski.cpp @@ -51,7 +51,7 @@ int SampleMaski::compare(const StateAttribute& sa) const void SampleMaski::apply(State& state) const { // get "per-context" extensions - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if ( (extensions->isTextureMultisampleSupported) || (extensions->isOpenGL32upported) || (extensions->isSampleMaskiSupported) ) { diff --git a/src/osg/Shader.cpp b/src/osg/Shader.cpp index 62d58cc2b..a07a5af72 100644 --- a/src/osg/Shader.cpp +++ b/src/osg/Shader.cpp @@ -177,7 +177,7 @@ void Shader::flushDeletedGlShaders(unsigned int contextID,double /*currentTime*/ // if no time available don't try to flush objects. if (availableTime<=0.0) return; - const GL2Extensions* extensions = GL2Extensions::Get(contextID,true); + const GLExtensions* extensions = GLExtensions::Get(contextID,true); if( ! extensions->isGlslSupported ) return; const osg::Timer& timer = *osg::Timer::instance(); @@ -458,7 +458,7 @@ Shader::PerContextShader::PerContextShader(const Shader* shader, unsigned int co _contextID( contextID ) { _shader = shader; - _extensions = GL2Extensions::Get( _contextID, true ); + _extensions = GLExtensions::Get( _contextID, true ); _glShaderHandle = _extensions->glCreateShader( shader->getType() ); requestCompile(); } diff --git a/src/osg/State.cpp b/src/osg/State.cpp index c5d50e67f..3650d8f2a 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -131,9 +131,9 @@ State::State(): State::~State() { - // delete the GL2Extensions object associated with this osg::State. - GL2Extensions::Set(_contextID, 0); - _gl2Extentsions = 0; + // delete the GLExtensions object associated with this osg::State. + GLExtensions::Set(_contextID, 0); + _glExtensions = 0; //_texCoordArrayList.clear(); @@ -922,8 +922,8 @@ void State::initializeExtensionProcs() { if (_extensionProcsInitialized) return; - _gl2Extentsions = new GL2Extensions(_contextID); - GL2Extensions::Set(_contextID, _gl2Extentsions.get()); + _glExtensions = new GLExtensions(_contextID); + GLExtensions::Set(_contextID, _glExtensions.get()); setGLExtensionFuncPtr(_glClientActiveTexture,"glClientActiveTexture","glClientActiveTextureARB"); setGLExtensionFuncPtr(_glActiveTexture, "glActiveTexture","glActiveTextureARB"); @@ -966,7 +966,7 @@ void State::initializeExtensionProcs() _glMaxTextureCoords = 1; } - if (_gl2Extentsions->isARBTimerQuerySupported) + if (_glExtensions->isARBTimerQuerySupported) { const GLubyte* renderer = glGetString(GL_RENDERER); std::string rendererString = renderer ? (const char*)renderer : ""; @@ -981,7 +981,7 @@ void State::initializeExtensionProcs() else { GLint bits = 0; - _gl2Extentsions->glGetQueryiv(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS_ARB, &bits); + _glExtensions->glGetQueryiv(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS_ARB, &bits); setTimestampBits(bits); } } @@ -1760,7 +1760,7 @@ void State::frameCompleted() if (getTimestampBits()) { GLint64 timestamp; - _gl2Extentsions->glGetInteger64v(GL_TIMESTAMP, ×tamp); + _glExtensions->glGetInteger64v(GL_TIMESTAMP, ×tamp); setGpuTimestamp(osg::Timer::instance()->tick(), timestamp); //OSG_NOTICE<<"State::frameCompleted() setting time stamp. timestamp="<(); + const GLExtensions* extensions = state.get(); Operation sf = validateOperation(extensions, _sfail); Operation zf = validateOperation(extensions, _zfail); Operation zp = validateOperation(extensions, _zpass); diff --git a/src/osg/StencilTwoSided.cpp b/src/osg/StencilTwoSided.cpp index 55204f719..5a4578971 100644 --- a/src/osg/StencilTwoSided.cpp +++ b/src/osg/StencilTwoSided.cpp @@ -88,7 +88,7 @@ void StencilTwoSided::apply(State& state) const { // get "per-context" extensions const unsigned int contextID = state.getContextID(); - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); // use OpenGL 2.0 functions if available if (extensions->isOpenGL20Supported) diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index a528095ad..f3336f998 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -1465,7 +1465,7 @@ void Texture::computeInternalFormatWithImage(const osg::Image& image) const { const unsigned int contextID = 0; // state.getContextID(); // set to 0 right now, assume same parameters for each graphics context... - const GL2Extensions* extensions = GL2Extensions::Get(contextID,true); + const GLExtensions* extensions = GLExtensions::Get(contextID,true); switch(_internalFormatMode) { @@ -1873,7 +1873,7 @@ void Texture::applyTexParameters(GLenum target, State& state) const // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); WrapMode ws = _wrap_s, wt = _wrap_t, wr = _wrap_r; @@ -2016,7 +2016,7 @@ void Texture::applyTexParameters(GLenum target, State& state) const void Texture::computeRequiredTextureDimensions(State& state, const osg::Image& image,GLsizei& inwidth, GLsizei& inheight,GLsizei& numMipmapLevels) const { - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); int width,height; @@ -2078,7 +2078,7 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima #endif // get extensions object - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); // select the internalFormat required for the texture. bool compressed_image = isCompressedInternalFormat((GLenum)image->getPixelFormat()); @@ -2485,7 +2485,7 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image* // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); // select the internalFormat required for the texture. bool compressed_image = isCompressedInternalFormat((GLenum)image->getPixelFormat()); @@ -2671,7 +2671,7 @@ bool Texture::isHardwareMipmapGenerationEnabled(const State& state) const { if (_useHardwareMipMapGeneration) { - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if (extensions->isGenerateMipMapSupported) { return true; @@ -2694,7 +2694,7 @@ Texture::GenerateMipmapMode Texture::mipmapBeforeTexImage(const State& state, bo return GENERATE_MIPMAP; #else - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); bool useGenerateMipMap = extensions->glGenerateMipmap!=0; if (useGenerateMipMap) @@ -2731,7 +2731,7 @@ void Texture::mipmapAfterTexImage(State& state, GenerateMipmapMode beforeResult) TextureObject* textureObject = getTextureObject(contextID); if (textureObject) { - osg::GL2Extensions* ext = state.get(); + osg::GLExtensions* ext = state.get(); ext->glGenerateMipmap(textureObject->target()); } break; @@ -2764,7 +2764,7 @@ void Texture::generateMipmap(State& state) const } // get fbo extension which provides us with the glGenerateMipmapEXT function - osg::GL2Extensions* ext = state.get(); + osg::GLExtensions* ext = state.get(); // check if the function is supported if (ext->glGenerateMipmap) diff --git a/src/osg/Texture1D.cpp b/src/osg/Texture1D.cpp index 8ad244d8c..f526338ee 100644 --- a/src/osg/Texture1D.cpp +++ b/src/osg/Texture1D.cpp @@ -278,7 +278,7 @@ void Texture1D::applyTexImage1D(GLenum target, Image* image, State& state, GLsiz return; // get extension object - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); // compute the internal texture format, this set the _internalFormat to an appropriate value. computeInternalFormat(); diff --git a/src/osg/Texture2DArray.cpp b/src/osg/Texture2DArray.cpp index 30a5fea6c..65a01f841 100644 --- a/src/osg/Texture2DArray.cpp +++ b/src/osg/Texture2DArray.cpp @@ -225,7 +225,7 @@ void Texture2DArray::apply(State& state) const ElapsedTime elapsedTime(&(tom->getApplyTime())); tom->getNumberApplied()++; - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); // if not supported, then return if (!extensions->isTexture2DArraySupported || !extensions->isTexture3DSupported) @@ -367,7 +367,7 @@ void Texture2DArray::apply(State& state) const } } - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); // source images have no mipmamps but we could generate them... if( _min_filter != LINEAR && _min_filter != NEAREST && !_images[0]->isMipmap() && _useHardwareMipMapGeneration && extensions->isGenerateMipMapSupported ) @@ -434,7 +434,7 @@ void Texture2DArray::applyTexImage2DArray_subload(State& state, Image* image, GL // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); GLenum target = GL_TEXTURE_2D_ARRAY_EXT; // compute the internal texture format, this set the _internalFormat to an appropriate value. @@ -582,7 +582,7 @@ void Texture2DArray::applyTexImage2DArray_subload(State& state, Image* image, GL void Texture2DArray::copyTexSubImage2DArray(State& state, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height ) { const unsigned int contextID = state.getContextID(); - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); // get the texture object for the current contextID. TextureObject* textureObject = getTextureObject(contextID); @@ -614,7 +614,7 @@ void Texture2DArray::allocateMipmap(State& state) const if (textureObject && _textureWidth != 0 && _textureHeight != 0 && _textureDepth != 0) { - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); int safeSourceFormat = _sourceFormat ? _sourceFormat : _internalFormat; diff --git a/src/osg/Texture2DMultisample.cpp b/src/osg/Texture2DMultisample.cpp index aacb80378..40e5eacd3 100644 --- a/src/osg/Texture2DMultisample.cpp +++ b/src/osg/Texture2DMultisample.cpp @@ -86,7 +86,7 @@ void Texture2DMultisample::apply(State& state) const { // current OpenGL context. const unsigned int contextID = state.getContextID(); - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if (!extensions->isTextureMultisampledSupported) { OSG_INFO<<"Texture2DMultisample not supoorted."<(); + const GLExtensions* extensions = state.get(); int width,height,depth; @@ -208,7 +208,7 @@ void Texture3D::apply(State& state) const ElapsedTime elapsedTime(&(tom->getApplyTime())); tom->getNumberApplied()++; - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if (!extensions->isTexture3DSupported) { @@ -365,7 +365,7 @@ void Texture3D::applyTexImage3D(GLenum target, Image* image, State& state, GLsiz // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); - const GL2Extensions* extensions = GL2Extensions::Get(contextID,true); + const GLExtensions* extensions = GLExtensions::Get(contextID,true); // compute the internal texture format, this set the _internalFormat to an appropriate value. computeInternalFormat(); @@ -486,7 +486,7 @@ void Texture3D::applyTexImage3D(GLenum target, Image* image, State& state, GLsiz void Texture3D::copyTexSubImage3D(State& state, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height ) { const unsigned int contextID = state.getContextID(); - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); // get the texture object for the current contextID. TextureObject* textureObject = getTextureObject(contextID); @@ -520,7 +520,7 @@ void Texture3D::allocateMipmap(State& state) const if (textureObject && _textureWidth != 0 && _textureHeight != 0 && _textureDepth != 0) { - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); // bind texture textureObject->bind(); diff --git a/src/osg/TextureBuffer.cpp b/src/osg/TextureBuffer.cpp index f9061a4c7..d7b1f0b28 100644 --- a/src/osg/TextureBuffer.cpp +++ b/src/osg/TextureBuffer.cpp @@ -122,7 +122,7 @@ void TextureBuffer::apply(State& state) const if( getTextureParameterDirty(contextID) ) { - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if (extensions->isBindImageTextureSupported() && _imageAttachment.access!=0) { extensions->glBindImageTexture( @@ -142,7 +142,7 @@ void TextureBuffer::apply(State& state) const textureBufferObject = new TextureBufferObject(contextID,_usageHint); _textureBufferObjects[contextID] = textureBufferObject; - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if (extensions->isBindImageTextureSupported() && _imageAttachment.access!=0) { extensions->glBindImageTexture( diff --git a/src/osg/TextureCubeMap.cpp b/src/osg/TextureCubeMap.cpp index 0d7b4186e..60b99ceec 100644 --- a/src/osg/TextureCubeMap.cpp +++ b/src/osg/TextureCubeMap.cpp @@ -203,7 +203,7 @@ void TextureCubeMap::apply(State& state) const ElapsedTime elapsedTime(&(tom->getApplyTime())); tom->getNumberApplied()++; - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if (!extensions->isCubeMapSupported) return; @@ -366,7 +366,7 @@ void TextureCubeMap::apply(State& state) const void TextureCubeMap::copyTexSubImageCubeMap(State& state, int face, int xoffset, int yoffset, int x, int y, int width, int height ) { const unsigned int contextID = state.getContextID(); - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if (!extensions->isCubeMapSupported) return; diff --git a/src/osg/TextureRectangle.cpp b/src/osg/TextureRectangle.cpp index 405dde7ff..567b3c871 100644 --- a/src/osg/TextureRectangle.cpp +++ b/src/osg/TextureRectangle.cpp @@ -157,7 +157,7 @@ void TextureRectangle::setImage(Image* image) void TextureRectangle::apply(State& state) const { - if (!state.get()->isRectangleSupported) + if (!state.get()->isRectangleSupported) { OSG_WARN<<"Warning: TextureRectangle::apply(..) failed, texture rectangle is not support by your OpenGL drivers."<(); + const GLExtensions* extensions = state.get(); // update the modified count to show that it is upto date. getModifiedCount(contextID) = image->getModifiedCount(); @@ -390,7 +390,7 @@ void TextureRectangle::applyTexImage_subload(GLenum target, Image* image, State& // get the contextID (user defined ID of 0 upwards) for the // current OpenGL context. const unsigned int contextID = state.getContextID(); - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); // update the modified count to show that it is upto date. diff --git a/src/osg/Uniform.cpp b/src/osg/Uniform.cpp index d4a703cfd..7f2630a52 100644 --- a/src/osg/Uniform.cpp +++ b/src/osg/Uniform.cpp @@ -973,7 +973,7 @@ unsigned int Uniform::getNameID(const std::string& name) typedef std::map UniformNameIDMap; static OpenThreads::Mutex s_mutex_uniformNameIDMap; static UniformNameIDMap s_uniformNameIDMap; - + OpenThreads::ScopedLock lock(s_mutex_uniformNameIDMap); UniformNameIDMap::iterator it = s_uniformNameIDMap.find(name); if (it != s_uniformNameIDMap.end()) @@ -2456,7 +2456,7 @@ unsigned int Uniform::getNameID() const /////////////////////////////////////////////////////////////////////////// -void Uniform::apply(const GL2Extensions* ext, GLint location) const +void Uniform::apply(const GLExtensions* ext, GLint location) const { // OSG_NOTICE << "uniform at "< -#include +#include #include using namespace osg; @@ -34,7 +34,7 @@ VertexAttribDivisor::~VertexAttribDivisor() void VertexAttribDivisor::apply(State& state) const { - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if (extensions->glVertexAttribDivisor) { extensions->glVertexAttribDivisor( _index, _divisor ); diff --git a/src/osg/VertexProgram.cpp b/src/osg/VertexProgram.cpp index 36314a023..ff22c4c22 100644 --- a/src/osg/VertexProgram.cpp +++ b/src/osg/VertexProgram.cpp @@ -56,7 +56,7 @@ void VertexProgram::flushDeletedVertexProgramObjects(unsigned int contextID,doub { OpenThreads::ScopedLock lock(s_mutex_deletedVertexProgramObjectCache); - const GL2Extensions* extensions = GL2Extensions::Get(contextID,true); + const GLExtensions* extensions = GLExtensions::Get(contextID,true); VertexProgramObjectList& vpol = s_deletedVertexProgramObjectCache[contextID]; @@ -127,7 +127,7 @@ void VertexProgram::apply(State& state) const { #ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE - const GL2Extensions* extensions = state.get(); + const GLExtensions* extensions = state.get(); if (!extensions->isVertexProgramSupported) return; diff --git a/src/osgFX/SpecularHighlights.cpp b/src/osgFX/SpecularHighlights.cpp index aa1c7cbcd..2baba5b29 100644 --- a/src/osgFX/SpecularHighlights.cpp +++ b/src/osgFX/SpecularHighlights.cpp @@ -114,7 +114,7 @@ namespace { if (!Technique::validate(state)) return false; - osg::GL2Extensions *ext = state.get(); + osg::GLExtensions *ext = state.get(); return ext ? ext->isCubeMapSupported : false; } diff --git a/src/osgParticle/PrecipitationEffect.cpp b/src/osgParticle/PrecipitationEffect.cpp index c17a34c64..08c295d1d 100644 --- a/src/osgParticle/PrecipitationEffect.cpp +++ b/src/osgParticle/PrecipitationEffect.cpp @@ -838,7 +838,7 @@ void PrecipitationEffect::PrecipitationDrawable::drawImplementation(osg::RenderI if (!_geometry) return; - const osg::GL2Extensions* extensions = renderInfo.getState()->get(); + const osg::GLExtensions* extensions = renderInfo.getState()->get(); // save OpenGL matrices glPushMatrix(); diff --git a/src/osgText/Glyph.cpp b/src/osgText/Glyph.cpp index ed80fe62e..8bd2d8abf 100644 --- a/src/osgText/Glyph.cpp +++ b/src/osgText/Glyph.cpp @@ -147,7 +147,7 @@ void GlyphTexture::apply(osg::State& state) const } - const osg::GL2Extensions* extensions = state.get(); + const osg::GLExtensions* extensions = state.get(); bool generateMipMapSupported = extensions->isGenerateMipMapSupported; // get the texture object for the current contextID. diff --git a/src/osgUtil/GLObjectsVisitor.cpp b/src/osgUtil/GLObjectsVisitor.cpp index 06970e5df..a4f7ab4c0 100644 --- a/src/osgUtil/GLObjectsVisitor.cpp +++ b/src/osgUtil/GLObjectsVisitor.cpp @@ -46,7 +46,7 @@ void GLObjectsVisitor::apply(osg::Node& node) if (programSetBefore && !programSetAfter) { osg::State* state = _renderInfo.getState(); - osg::GL2Extensions* extensions = state->get(); + osg::GLExtensions* extensions = state->get(); extensions->glUseProgram(0); state->setLastAppliedProgramObject(0); _lastCompiledProgram = 0; @@ -68,7 +68,7 @@ void GLObjectsVisitor::apply(osg::Geode& node) if (!programSetBefore && programSetAfter) { osg::State* state = _renderInfo.getState(); - osg::GL2Extensions* extensions = state->get(); + osg::GLExtensions* extensions = state->get(); extensions->glUseProgram(0); state->setLastAppliedProgramObject(0); _lastCompiledProgram = 0; @@ -157,7 +157,7 @@ void GLObjectsVisitor::apply(osg::StateSet& stateset) else if(_renderInfo.getState()->getLastAppliedProgramObject()) { osg::State* state = _renderInfo.getState(); - osg::GL2Extensions* extensions = state->get(); + osg::GLExtensions* extensions = state->get(); extensions->glUseProgram(0); _renderInfo.getState()->setLastAppliedProgramObject(0); } diff --git a/src/osgUtil/RenderStage.cpp b/src/osgUtil/RenderStage.cpp index 672e3f47c..d9f6526ff 100644 --- a/src/osgUtil/RenderStage.cpp +++ b/src/osgUtil/RenderStage.cpp @@ -338,7 +338,7 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) if (renderTargetImplementation==osg::Camera::FRAME_BUFFER_OBJECT) { - osg::GL2Extensions* ext = state.get(); + osg::GLExtensions* ext = state.get(); bool fbo_supported = ext->isFrameBufferObjectSupported; if (fbo_supported) @@ -903,7 +903,7 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b osg::State& state = *renderInfo.getState(); - osg::GL2Extensions* ext = _fbo.valid() ? state.get() : 0; + osg::GLExtensions* ext = _fbo.valid() ? state.get() : 0; bool fbo_supported = ext && ext->isFrameBufferObjectSupported; bool using_multiple_render_targets = fbo_supported && _fbo->hasMultipleRenderingTargets(); diff --git a/src/osgViewer/Renderer.cpp b/src/osgViewer/Renderer.cpp index ff7c160eb..b322810e1 100644 --- a/src/osgViewer/Renderer.cpp +++ b/src/osgViewer/Renderer.cpp @@ -132,7 +132,7 @@ void EXTQuerySupport::endQuery(osg::State* /*state*/) void OpenGLQuerySupport::initialize(osg::State* state, osg::Timer_t /*startTick*/) { - _extensions = state->get(); + _extensions = state->get(); } void EXTQuerySupport::initialize(osg::State* state, osg::Timer_t startTick) @@ -464,7 +464,7 @@ void Renderer::initialize(osg::State* state) if (!_initialized) { _initialized = true; - osg::GL2Extensions* ext = state->get(); + osg::GLExtensions* ext = state->get(); if (ext->isARBTimerQuerySupported && state->getTimestampBits() > 0) _querySupport = new ARBQuerySupport(); else if (ext->isTimerQuerySupported) diff --git a/src/osgViewer/ScreenCaptureHandler.cpp b/src/osgViewer/ScreenCaptureHandler.cpp index 299275692..27a8eb3e6 100644 --- a/src/osgViewer/ScreenCaptureHandler.cpp +++ b/src/osgViewer/ScreenCaptureHandler.cpp @@ -72,8 +72,8 @@ class WindowCaptureCallback : public osg::Camera::DrawCallback void read(); void readPixels(); - void singlePBO(osg::GL2Extensions* ext); - void multiPBO(osg::GL2Extensions* ext); + void singlePBO(osg::GLExtensions* ext); + void multiPBO(osg::GLExtensions* ext); typedef std::vector< osg::ref_ptr > ImageBuffer; typedef std::vector< GLuint > PBOBuffer; @@ -218,7 +218,7 @@ void WindowCaptureCallback::ContextData::updateTimings(osg::Timer_t tick_start, void WindowCaptureCallback::ContextData::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()) { @@ -275,7 +275,7 @@ void WindowCaptureCallback::ContextData::readPixels() _currentPboIndex = nextPboIndex; } -void WindowCaptureCallback::ContextData::singlePBO(osg::GL2Extensions* ext) +void WindowCaptureCallback::ContextData::singlePBO(osg::GLExtensions* ext) { unsigned int nextImageIndex = (_currentImageIndex+1)%_imageBuffer.size(); @@ -350,7 +350,7 @@ void WindowCaptureCallback::ContextData::singlePBO(osg::GL2Extensions* ext) _currentImageIndex = nextImageIndex; } -void WindowCaptureCallback::ContextData::multiPBO(osg::GL2Extensions* ext) +void WindowCaptureCallback::ContextData::multiPBO(osg::GLExtensions* ext) { unsigned int nextImageIndex = (_currentImageIndex+1)%_imageBuffer.size(); unsigned int nextPboIndex = (_currentPboIndex+1)%_pboBuffer.size(); diff --git a/src/osgViewer/StatsHandler.cpp b/src/osgViewer/StatsHandler.cpp index c6965eb34..d8c92825c 100644 --- a/src/osgViewer/StatsHandler.cpp +++ b/src/osgViewer/StatsHandler.cpp @@ -1102,7 +1102,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer) if ((*citr)->getGraphicsContext()) { const osg::State* state = (*citr)->getGraphicsContext()->getState(); - const osg::GL2Extensions* extensions = state->get(); + const osg::GLExtensions* extensions = state->get(); if (extensions && (((extensions->isARBTimerQuerySupported && state->getTimestampBits() > 0)) || extensions->isTimerQuerySupported)) {