OpenGL: Make use of the requested version and profile in QGLWidget

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>
bb10
Sean Harmer 2012-09-19 14:09:16 +01:00 committed by The Qt Project
parent c45005a778
commit 77fc6d30f1
1 changed files with 3 additions and 0 deletions

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