summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@digia.com>2013-02-07 12:59:34 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-09 13:55:00 +0100
commitd1acaf2b1c60f276dfbe4ed33eb3b6800d99fcbb (patch)
tree1ab6fe532b90d54fc899509fe17b9fc7f51f0183
parent3798b129c032dbd2ac1ccab071ad3ad4ebc2edf3 (diff)
Fixed QOpenGLFunctions feature/extension detection to check GL version
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ø <tor.arne.vestbo@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp11
1 files changed, 9 insertions, 2 deletions
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;