42 #include <ACG/GL/acg_glew.hh> 61 inline const char *_getExtensionString() {
66 return (
const char*) glGetString(GL_EXTENSIONS);
74 static std::string supported_str;
76 if (supported_str.empty()) {
78 glGetIntegerv(GL_NUM_EXTENSIONS, &extensions);
80 for (
int i = 0; i < extensions; ++i) {
82 const char *supported_cstr =
reinterpret_cast<const char*
>(glGetStringi(GL_EXTENSIONS, i));
84 if (supported_cstr == 0) {
85 std::cerr <<
"\x1b[1;31mACG::checkExtensionsSupported: " 86 "glGetStringi(GL_EXTENSIONS, "<<i<<
") call failed.\x1b[0m\n";
90 supported_str += supported_cstr;
91 if (i + 1 < extensions)
96 return supported_str.c_str();
102 return _getExtensionString();
112 static const std::string supported_str(_getExtensionString());
119 for (std::istringstream supported(supported_str); !supported.eof(); ) {
121 supported >> feature;
122 if (feature == _extension)
return true;
132 std::string glVersionString = (
const char*)glGetString(GL_VERSION);
135 std::istringstream stream;
136 stream.str(glVersionString);
150 if ( (_major > major) || ( (_major == major) && (_minor > minor)) ) {
153 std::cerr <<
"OpenGL Version check failed. Required : " << _major <<
"." << _minor << std::endl;
154 std::cerr <<
"OpenGL Version check failed. Available : " << major <<
"." << minor << std::endl;
163 static bool compatibilityProfile_ =
false;
167 compatibilityProfile_ = _enableCoreProfile;
172 return compatibilityProfile_;
Namespace providing different geometric functions concerning angles.
bool openGLVersion(const int _major, const int _minor, bool _verbose)
bool checkExtensionSupported(const std::string &_extension)
void compatibilityProfile(bool _enableCoreProfile)
Store opengl core profile setting.
std::string getExtensionString()
getExtensionString returns a string containing all supported OpenGL extensions this function uses the...