From d1acaf2b1c60f276dfbe4ed33eb3b6800d99fcbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 7 Feb 2013 12:59:34 +0100 Subject: Fixed QOpenGLFunctions feature/extension detection to check GL version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the GL version is new enough the extension string won't contain features that have been standardized. So far we only check for FBOs. Change-Id: Ib29826f378b394894885717c062872581bd5c9f5 Reviewed-by: Tor Arne Vestbø Reviewed-by: Gunnar Sletta Reviewed-by: Sean Harmer --- src/gui/opengl/qopenglfunctions.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/gui/opengl/qopenglfunctions.cpp') diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp index ee5855d866..3737df7497 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -289,7 +289,7 @@ static int qt_gl_resolve_features() return features; #else int features = 0; - //QOpenGLFormat::OpenGLVersionFlags versions = QOpenGLFormat::openGLVersionFlags(); + QSurfaceFormat format = QOpenGLContext::currentContext()->format(); QOpenGLExtensionMatcher extensions; // Recognize features by extension name. @@ -327,6 +327,10 @@ static int qt_gl_resolve_features() QOpenGLFunctions::StencilSeparate | QOpenGLFunctions::BlendEquationSeparate | QOpenGLFunctions::NPOTTextures; + + if (format.majorVersion() >= 3) + features |= QOpenGLFunctions::Framebuffers; + return features; #endif } @@ -349,10 +353,13 @@ static int qt_gl_resolve_extensions() extensions |= QOpenGLExtensions::BGRATextureFormat; #else + QSurfaceFormat format = QOpenGLContext::currentContext()->format(); extensions |= QOpenGLExtensions::ElementIndexUint | QOpenGLExtensions::MapBuffer; // Recognize features by extension name. - if (extensionMatcher.match("GL_ARB_framebuffer_object")) { + if (format.majorVersion() >= 3 + || extensionMatcher.match("GL_ARB_framebuffer_object")) + { extensions |= QOpenGLExtensions::FramebufferMultisample | QOpenGLExtensions::FramebufferBlit | QOpenGLExtensions::PackedDepthStencil; -- cgit v1.2.3