diff --git a/modules/juce_opengl/opengl/juce_OpenGLHelpers.cpp b/modules/juce_opengl/opengl/juce_OpenGLHelpers.cpp index 54ea447f8a..f4b26e795f 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLHelpers.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLHelpers.cpp @@ -133,6 +133,23 @@ bool OpenGLHelpers::isExtensionSupported (const char* const extensionName) jassert (extensionName != nullptr); // you must supply a genuine string for this. jassert (isContextActive()); // An OpenGL context will need to be active before calling this. + if (getOpenGLVersion().major >= 3) + { + using GetStringi = const GLubyte* (*) (GLenum, GLuint); + + if (auto* thisGlGetStringi = reinterpret_cast (getExtensionFunction ("glGetStringi"))) + { + GLint n = 0; + glGetIntegerv (GL_NUM_EXTENSIONS, &n); + + for (auto i = (decltype (n)) 0; i < n; ++i) + if (StringRef (extensionName) == StringRef ((const char*) thisGlGetStringi (GL_EXTENSIONS, (GLuint) i))) + return true; + + return false; + } + } + const char* extensions = (const char*) glGetString (GL_EXTENSIONS); jassert (extensions != nullptr); // Perhaps you didn't activate an OpenGL context before calling this?