diff --git a/src/osg/BlendEquation.cpp b/src/osg/BlendEquation.cpp index 7e7cc052f..ae3968af3 100644 --- a/src/osg/BlendEquation.cpp +++ b/src/osg/BlendEquation.cpp @@ -108,8 +108,8 @@ void BlendEquation::Extensions::setupGLExtenions(unsigned int contextID) _isBlendEquationSupported = isGLExtensionSupported(contextID,"GL_EXT_blend_equation") || strncmp((const char*)glGetString(GL_VERSION),"1.2",3)>=0; - _isSGIXMinMaxSupported = isGLExtensionSupported(contextID, "SGIX_blend_alpha_minmax"); - _isLogicOpSupported = isGLExtensionSupported(contextID, "EXT_blend_logic_op"); + _isSGIXMinMaxSupported = isGLExtensionSupported(contextID, "GL_SGIX_blend_alpha_minmax"); + _isLogicOpSupported = isGLExtensionSupported(contextID, "GL_EXT_blend_logic_op"); _glBlendEquation = getGLExtensionFuncPtr("glBlendEquation", "glBlendEquationEXT"); } diff --git a/src/osg/GLExtensions.cpp b/src/osg/GLExtensions.cpp index 26d72defb..6158d44d0 100644 --- a/src/osg/GLExtensions.cpp +++ b/src/osg/GLExtensions.cpp @@ -24,6 +24,10 @@ #include #include +#if defined(WIN32) +#include +#endif + bool osg::isGLExtensionSupported(unsigned int contextID, const char *extension) { typedef std::set ExtensionSet; @@ -56,6 +60,44 @@ bool osg::isGLExtensionSupported(unsigned int contextID, const char *extension) startOfWord = endOfWord+1; } if (*startOfWord!=0) extensionSet.insert(std::string(startOfWord)); + +#if defined(WIN32) + + // add WGL extensions to the list + + typedef const char* WINAPI WGLGETEXTENSIONSSTRINGARB(HDC); + WGLGETEXTENSIONSSTRINGARB* wglGetExtensionsStringARB = + (WGLGETEXTENSIONSSTRINGARB*)getGLExtensionFuncPtr("wglGetExtensionsStringARB"); + + typedef const char* WINAPI WGLGETEXTENSIONSSTRINGEXT(); + WGLGETEXTENSIONSSTRINGEXT* wglGetExtensionsStringEXT = + (WGLGETEXTENSIONSSTRINGEXT*)getGLExtensionFuncPtr("wglGetExtensionsStringEXT"); + + const char* wglextensions = 0; + + if (wglGetExtensionsStringARB) + { + HDC dc = wglGetCurrentDC(); + wglextensions = wglGetExtensionsStringARB(dc); + } + else if (wglGetExtensionsStringEXT) + { + wglextensions = wglGetExtensionsStringEXT(); + } + + if (wglextensions) + { + const char* startOfWord = wglextensions; + const char* endOfWord; + while ((endOfWord = strchr(startOfWord, ' '))) + { + extensionSet.insert(std::string(startOfWord, endOfWord)); + startOfWord = endOfWord+1; + } + if (*startOfWord != 0) extensionSet.insert(std::string(startOfWord)); + } + +#endif osg::notify(INFO)<<"OpenGL extensions supported by installed OpenGL drivers are:"<