From bca7e4e73b19c99df446e6a1a5d96905d79a343f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 20 Aug 2003 10:38:54 +0000 Subject: [PATCH] Added osg::setGLExtensionDisableString && osg::getGLExtensionDisableString() functions the GLExtensions file, and made the isGLExtensionSupported() function use the extension disable string when extension are querried. --- include/osg/GLExtensions | 19 ++++++++- src/osg/GLExtensions.cpp | 83 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 99 insertions(+), 3 deletions(-) diff --git a/include/osg/GLExtensions b/include/osg/GLExtensions index 95f28b0fd..b8e26bb9c 100644 --- a/include/osg/GLExtensions +++ b/include/osg/GLExtensions @@ -15,13 +15,13 @@ #define OSG_GLEXTENSIONS 1 #include +#include #if defined(WIN32) #define WIN32_LEAN_AND_MEAN #define NOMINMAX #include #elif defined(__DARWIN_OSX__) - #include #include #else #include @@ -29,6 +29,8 @@ namespace osg { + + /** return true if OpenGL "extension" is supported. * note: Must only called within a valid OpenGL context, * undefined behavior may occur otherwise. @@ -71,6 +73,21 @@ inline void* getGLExtensionFuncPtr(const char *funcName) #endif } +/** Set a list of extensions to disable for different OpenGL renders, this allows + * OSG applications to work around OpenGL drivers bugs which are due to problemenatic extension support. + * The format of the string is: + * "GLRendererString : ExtensionName, ExtensionName; GLRenderString2 : ExtensionName;" + * An example of is : "SUN_XVR1000:GL_EXT_texture_filter_anisotropic" + * The default setting of GLExtensionDisableString is obtain from the OSG_GL_EXTENSION_DISABLE + * environmental variable. + */ +extern SG_EXPORT void setGLExtensionDisableString(const std::string& disableString); + +/** Get the list of extensions that are disabled for various OpenGL renders.*/ +extern SG_EXPORT std::string& getGLExtensionDisableString(); + + + /** return the address of the specified OpenGL function, if not found then * check a second function name, if this fails then return NULL as function is * not supported by OpenGL library. This is usual for checking something diff --git a/src/osg/GLExtensions.cpp b/src/osg/GLExtensions.cpp index d76d5bacd..c3c66425e 100644 --- a/src/osg/GLExtensions.cpp +++ b/src/osg/GLExtensions.cpp @@ -58,12 +58,91 @@ bool osg::isGLExtensionSupported(const char *extension) // true if extension found in extensionSet. bool result = s_extensionSet.find(extension)!=s_extensionSet.end(); - if (result) osg::notify(INFO)<<"OpenGL extension '"< ExtensionSet;