From 11823f66006f4e0686e39544492c5569b47ac8eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 15 Sep 2012 01:20:38 +0200 Subject: [PATCH] Context: use glGetString(GL_EXTENSIONS) on GL 2.1. glGetStringi() is since GL 3.0. --- src/Context.cpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/Context.cpp b/src/Context.cpp index bb484f8dc..f6bdfd1ad 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -165,13 +165,26 @@ Context::Context() { futureExtensions.insert(make_pair(extension._string, extension)); /* Check for presence of extensions in future versions */ - GLuint index = 0; - const char* extension; - while((extension = reinterpret_cast(glGetStringi(GL_EXTENSIONS, index++)))) { - auto found = futureExtensions.find(extension); - if(found != futureExtensions.end()) { - _supportedExtensions.push_back(found->second); - extensionStatus.set(found->second._index); + if(isVersionSupported(Version::GL300)) { + GLuint index = 0; + const char* extension; + while((extension = reinterpret_cast(glGetStringi(GL_EXTENSIONS, index++)))) { + auto found = futureExtensions.find(extension); + if(found != futureExtensions.end()) { + _supportedExtensions.push_back(found->second); + extensionStatus.set(found->second._index); + } + } + + /* OpenGL 2.1 doesn't have glGetStringi() */ + } else { + vector extensions = Corrade::Utility::split(reinterpret_cast(glGetString(GL_EXTENSIONS)), ' '); + for(const string& extension: extensions) { + auto found = futureExtensions.find(extension); + if(found != futureExtensions.end()) { + _supportedExtensions.push_back(found->second); + extensionStatus.set(found->second._index); + } } }