Detect GLX version, patch by Philip Falkner.

svn path=/branches/work/kwin_composite/; revision=604801
This commit is contained in:
Luboš Luňák 2006-11-14 11:41:52 +00:00
parent 012be9b663
commit e86e1cf88f
2 changed files with 24 additions and 8 deletions

View file

@ -18,6 +18,8 @@ namespace KWinInternal
// Variables
// GL version, use MAKE_OPENGL_VERSION() macro for comparing with a specific version
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;
int glTextureUnitsCount;
@ -50,6 +52,12 @@ void initGLX()
glXGetProcAddress = (glXGetProcAddress_func) getProcAddress( "glxGetProcAddressARB" );
glXBindTexImageEXT = (glXBindTexImageEXT_func) getProcAddress( "glXBindTexImageEXT" );
glXReleaseTexImageEXT = (glXReleaseTexImageEXT_func) getProcAddress( "glXReleaseTexImageEXT" );
// Get GLX version
int major, minor;
glXQueryVersion( display(), &major, &minor );
glXVersion = MAKE_GLX_VERSION( major, minor, 0 );
}
void initGL()
@ -75,6 +83,12 @@ bool hasGLVersion(int major, int minor, int release)
{
return glVersion >= MAKE_OPENGL_VERSION(major, minor, release);
}
bool hasGLXVersion(int major, int minor, int release)
{
return glXVersion >= MAKE_GLX_VERSION(major, minor, release);
}
bool hasGLExtension(const QString& extension)
{
return glExtensions.contains(extension);

View file

@ -23,6 +23,7 @@ License. See the file "COPYING" for the exact licensing terms.
#define MAKE_OPENGL_VERSION(major, minor, release) ( ((major) << 16) | ((minor) << 8) | (release) )
#define MAKE_GLX_VERSION(major, minor, release) ( ((major) << 16) | ((minor) << 8) | (release) )
namespace KWinInternal
@ -42,6 +43,7 @@ extern int glTextureUnitsCount;
bool hasGLVersion(int major, int minor, int release = 0);
bool hasGLXVersion(int major, int minor, int release = 0);
bool hasGLExtension(const QString& extension);