From 26f23b656b59c6c7d4e94c109bf9601580c09c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Wed, 13 Mar 2013 16:24:55 +0100 Subject: [PATCH] kwin/glx: Try to create an OpenGL 3.1 core context --- glxbackend.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/glxbackend.cpp b/glxbackend.cpp index e7df14f908..cf28a9acb5 100644 --- a/glxbackend.cpp +++ b/glxbackend.cpp @@ -138,8 +138,23 @@ bool GlxBackend::initRenderingContext() // Use glXCreateContextAttribsARB() when it's available if (glXCreateContextAttribsARB) { - int attribs[] = { 0 }; - ctx = glXCreateContextAttribsARB(display(), fbconfig, 0, direct, attribs); + const int attribs_31_core[] = { + GLX_CONTEXT_MAJOR_VERSION_ARB, 3, + GLX_CONTEXT_MINOR_VERSION_ARB, 1, + GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, + 0 + }; + + const int attribs_legacy[] = { + 0 + }; + + // Try to create a 3.1 context first + if (options->glCoreProfile()) + ctx = glXCreateContextAttribsARB(display(), fbconfig, 0, direct, attribs_31_core); + + if (!ctx) + ctx = glXCreateContextAttribsARB(display(), fbconfig, 0, direct, attribs_legacy); } if (!ctx)