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>
This commit is contained in:
Morten Johan Sørvig 2017-08-07 11:54:20 +02:00 committed by Simon Hausmann
parent 0a7eb034f4
commit 8b8578a155

View File

@ -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;
}