hellogles3: Request core profile context

...instead of compatibility, in order to play nice with systems
that have no compatibility profile support (macOS). Instancing
needs OpenGL 3.x so sticking with 2.x contexts is not an option.

The example looks fully compatible with core profile so its
functionality should not change.

Change-Id: If0d554a6208973aa8a4fb86757e246d170cd0e71
Fixes: QTBUG-75680
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Laszlo Agocs 2019-05-10 13:42:02 +02:00 committed by Tor Arne Vestbø
parent a9246c7132
commit 45aa3c73f7

View File

@ -69,11 +69,11 @@ int main(int argc, char *argv[])
QSurfaceFormat fmt; QSurfaceFormat fmt;
fmt.setDepthBufferSize(24); fmt.setDepthBufferSize(24);
// Request OpenGL 3.3 compatibility or OpenGL ES 3.0. // Request OpenGL 3.3 core or OpenGL ES 3.0.
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) { if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
qDebug("Requesting 3.3 compatibility context"); qDebug("Requesting 3.3 core context");
fmt.setVersion(3, 3); fmt.setVersion(3, 3);
fmt.setProfile(QSurfaceFormat::CompatibilityProfile); fmt.setProfile(QSurfaceFormat::CoreProfile);
} else { } else {
qDebug("Requesting 3.0 context"); qDebug("Requesting 3.0 context");
fmt.setVersion(3, 0); fmt.setVersion(3, 0);