summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2017-08-07 11:54:20 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2017-08-22 05:08:04 +0000
commit8b8578a155b7932a79049174f913eea3379c0f28 (patch)
tree18d1daecb2de584308412239947e00c867668324 /src/platformsupport
parent0a7eb034f402637e139072dc19579775a416e2a8 (diff)
macOS: Add support for OpenGL Core Profile 4.1
NSOpenGLProfileVersion4_1Core is available starting with macOS 10.10. Task-number: QTBUG-62333 Change-Id: I75d8c3bc1093ff38c6ca1db2d2da50fd448a149f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/cglconvenience/cglconvenience.mm16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/platformsupport/cglconvenience/cglconvenience.mm b/src/platformsupport/cglconvenience/cglconvenience.mm
index 85add35879..44238f2273 100644
--- a/src/platformsupport/cglconvenience/cglconvenience.mm
+++ b/src/platformsupport/cglconvenience/cglconvenience.mm
@@ -81,13 +81,17 @@ void *qcgl_createNSOpenGLPixelFormat(const QSurfaceFormat &format)
else if (format.swapBehavior() == QSurfaceFormat::TripleBuffer)
attrs.append(NSOpenGLPFATripleBuffer);
- if (format.profile() == QSurfaceFormat::CoreProfile
- && ((format.majorVersion() == 3 && format.minorVersion() >= 2)
- || format.majorVersion() > 3)) {
- attrs << NSOpenGLPFAOpenGLProfile;
- attrs << NSOpenGLProfileVersion3_2Core;
+
+ // Select OpenGL profile
+ attrs << NSOpenGLPFAOpenGLProfile;
+ if (format.profile() == QSurfaceFormat::CoreProfile) {
+ if (format.version() >= qMakePair(4, 1))
+ attrs << NSOpenGLProfileVersion4_1Core;
+ else if (format.version() >= qMakePair(3, 2))
+ attrs << NSOpenGLProfileVersion3_2Core;
+ else
+ attrs << NSOpenGLProfileVersionLegacy;
} else {
- attrs << NSOpenGLPFAOpenGLProfile;
attrs << NSOpenGLProfileVersionLegacy;
}