Merge MAKE_*_VERSION macros into MAKE_GL_VERSION and move it to .cpp file

svn path=/branches/work/kwin_composite/; revision=628353
This commit is contained in:
Rivo Laks 2007-01-29 21:06:56 +00:00
parent 8d01ae32ea
commit 26e907c210
2 changed files with 9 additions and 10 deletions

View file

@ -13,12 +13,15 @@ License. See the file "COPYING" for the exact licensing terms.
#include <dlfcn.h> #include <dlfcn.h>
#define MAKE_GL_VERSION(major, minor, release) ( ((major) << 16) | ((minor) << 8) | (release) )
namespace KWinInternal namespace KWinInternal
{ {
// Variables // Variables
// GL version, use MAKE_OPENGL_VERSION() macro for comparing with a specific version // GL version, use MAKE_GL_VERSION() macro for comparing with a specific version
static int glVersion; static int glVersion;
// GLX version, use MAKE_GLX_VERSION() macro for comparing with a specific version // GLX version, use MAKE_GL_VERSION() macro for comparing with a specific version
static int glXVersion; static int glXVersion;
// List of all supported GL and GLX extensions // List of all supported GL and GLX extensions
static QStringList glExtensions; static QStringList glExtensions;
@ -56,7 +59,7 @@ void initGLX()
// Get GLX version // Get GLX version
int major, minor; int major, minor;
glXQueryVersion( display(), &major, &minor ); glXQueryVersion( display(), &major, &minor );
glXVersion = MAKE_GLX_VERSION( major, minor, 0 ); glXVersion = MAKE_GL_VERSION( major, minor, 0 );
// Get list of supported GLX extensions. Simply add it to the list of OpenGL extensions. // Get list of supported GLX extensions. Simply add it to the list of OpenGL extensions.
glExtensions += QString((const char*)glXQueryExtensionsString( glExtensions += QString((const char*)glXQueryExtensionsString(
display(), DefaultScreen( display()))).split(" "); display(), DefaultScreen( display()))).split(" ");
@ -97,7 +100,7 @@ void initGL()
// Get OpenGL version // Get OpenGL version
QString glversionstring = QString((const char*)glGetString(GL_VERSION)); QString glversionstring = QString((const char*)glGetString(GL_VERSION));
QStringList glversioninfo = glversionstring.left(glversionstring.indexOf(' ')).split('.'); QStringList glversioninfo = glversionstring.left(glversionstring.indexOf(' ')).split('.');
glVersion = MAKE_OPENGL_VERSION(glversioninfo[0].toInt(), glversioninfo[1].toInt(), glVersion = MAKE_GL_VERSION(glversioninfo[0].toInt(), glversioninfo[1].toInt(),
glversioninfo.count() > 2 ? glversioninfo[2].toInt() : 0); glversioninfo.count() > 2 ? glversioninfo[2].toInt() : 0);
// Get list of supported OpenGL extensions // Get list of supported OpenGL extensions
glExtensions = QString((const char*)glGetString(GL_EXTENSIONS)).split(" "); glExtensions = QString((const char*)glGetString(GL_EXTENSIONS)).split(" ");
@ -120,12 +123,12 @@ void initGL()
bool hasGLVersion(int major, int minor, int release) bool hasGLVersion(int major, int minor, int release)
{ {
return glVersion >= MAKE_OPENGL_VERSION(major, minor, release); return glVersion >= MAKE_GL_VERSION(major, minor, release);
} }
bool hasGLXVersion(int major, int minor, int release) bool hasGLXVersion(int major, int minor, int release)
{ {
return glXVersion >= MAKE_GLX_VERSION(major, minor, release); return glXVersion >= MAKE_GL_VERSION(major, minor, release);
} }
bool hasGLExtension(const QString& extension) bool hasGLExtension(const QString& extension)

View file

@ -22,10 +22,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include <GL/glxext.h> #include <GL/glxext.h>
#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 namespace KWinInternal
{ {