OpenGL: Make use of the requested version and profile in QGLWidget
authorSean Harmer <sean.harmer@kdab.com>
Wed, 19 Sep 2012 13:09:16 +0000 (14:09 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 19 Sep 2012 14:16:38 +0000 (16:16 +0200)
When instatiating a QGLWidget in Qt5 at present it ignores the version
and profile information in the QGLFormat meaning that we always end up
with an OpenGL 2.x profile rather than what we asked for. This commit
properly takes the version and profile into account.

Change-Id: I097f10e397c23f5d97c5fcd8d5354667da286896
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
src/opengl/qgl_qpa.cpp

index 8a07b6a..556463b 100644 (file)
@@ -104,6 +104,9 @@ QSurfaceFormat QGLFormat::toSurfaceFormat(const QGLFormat &format)
     if (format.stencil())
         retFormat.setStencilBufferSize(format.stencilBufferSize() == -1 ? 1 : format.stencilBufferSize());
     retFormat.setStereo(format.stereo());
+    retFormat.setMajorVersion(format.majorVersion());
+    retFormat.setMinorVersion(format.minorVersion());
+    retFormat.setProfile(static_cast<QSurfaceFormat::OpenGLContextProfile>(format.profile()));
     return retFormat;
 }