From 1be2c4ed3201fa3f9674fda30c2c1dada30a66c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Tue, 14 Nov 2006 11:52:20 +0000 Subject: [PATCH] Detect and check GLX version/extensions. svn path=/branches/work/kwin_composite/; revision=604805 --- glutils.cpp | 12 +++++++----- glutils.h | 1 + scene_opengl.cpp | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/glutils.cpp b/glutils.cpp index 9c8af48704..8e5375099f 100644 --- a/glutils.cpp +++ b/glutils.cpp @@ -17,11 +17,11 @@ namespace KWinInternal { // Variables // GL version, use MAKE_OPENGL_VERSION() macro for comparing with a specific version -int glVersion; +static int glVersion; // GLX version, use MAKE_GLX_VERSION() macro for comparing with a specific version -int glXVersion; -// List of all supported GL extensions -QStringList glExtensions; +static int glXVersion; +// List of all supported GL and GLX extensions +static QStringList glExtensions; int glTextureUnitsCount; // Function pointers @@ -58,6 +58,9 @@ void initGLX() int major, minor; glXQueryVersion( display(), &major, &minor ); glXVersion = MAKE_GLX_VERSION( major, minor, 0 ); + // Get list of supported GLX extensions. Simply add it to the list of OpenGL extensions. + glExtensions += QString((const char*)glXQueryExtensionsString( + display(), DefaultScreen( display()))).split(" "); } void initGL() @@ -94,5 +97,4 @@ bool hasGLExtension(const QString& extension) return glExtensions.contains(extension); } - } // namespace diff --git a/glutils.h b/glutils.h index be6b03f32d..93886aea22 100644 --- a/glutils.h +++ b/glutils.h @@ -44,6 +44,7 @@ extern int glTextureUnitsCount; bool hasGLVersion(int major, int minor, int release = 0); bool hasGLXVersion(int major, int minor, int release = 0); +// use for both OpenGL and GLX extensions bool hasGLExtension(const QString& extension); diff --git a/scene_opengl.cpp b/scene_opengl.cpp index f15481afcc..2033e244f1 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -149,6 +149,9 @@ SceneOpenGL::SceneOpenGL( Workspace* ws ) if( !glXQueryExtension( display(), &dummy, &dummy )) return; initGLX(); + // check for FBConfig support + if( !hasGLXVersion( 1, 3 ) && !hasGLExtension( "GLX_SGIX_fbconfig" )) + return; tfp_mode = ( glXBindTexImageEXT != NULL && glXReleaseTexImageEXT != NULL ); // use copy buffer hack from glcompmgr (called COPY_BUFFER there) - nvidia drivers older than // 1.0-9xxx don't update pixmaps properly, so do a copy first