Commit 2f1798ba authored by Jan Möbius's avatar Jan Möbius
Browse files

Added gl function for version check

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11600 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 477c2f53
......@@ -53,6 +53,7 @@
//== INCLUDES =================================================================
#include <stdlib.h>
#include <sstream>
#if defined(ARCH_DARWIN)
......@@ -262,6 +263,37 @@ inline bool checkExtensionSupported( std::string _extension ) {
return (supported.find(_extension) != std::string::npos);
}
/** Check if OpenGL Version is greater or equal than the given values
*/
inline bool openGLVersion( const int _major, const int _minor ) {
// Read OpenGL Version string
std::string glVersionString = (const char*)glGetString(GL_VERSION);
// Use stringstream to pars
std::istringstream stream;
stream.str(glVersionString);
// Buffer for the dot between major and minor
char dot;
// Read Major version number
int major ;
stream >> major;
stream >> dot;
// Read minor version number
int minor;
stream >> minor;
if ( ! ((_major >= major) && (_minor>= minor)) ) {
std::cerr << "OpenGL Version check failed. Required : " << _major << "." << _minor << std::endl;
std::cerr << "OpenGL Version check failed. Available : " << major << "." << minor << std::endl;
}
return ((_major >= major) && (_minor>= minor));
}
/** Nice wrapper that outputs all current OpenGL errors to std::cerr.
If no error is present nothing is printed.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment