Browse Source

Context: use glGetString(GL_EXTENSIONS) on GL 2.1.

glGetStringi() is since GL 3.0.
pull/279/head
Vladimír Vondruš 14 years ago
parent
commit
11823f6600
  1. 27
      src/Context.cpp

27
src/Context.cpp

@ -165,13 +165,26 @@ Context::Context() {
futureExtensions.insert(make_pair(extension._string, extension)); futureExtensions.insert(make_pair(extension._string, extension));
/* Check for presence of extensions in future versions */ /* Check for presence of extensions in future versions */
GLuint index = 0; if(isVersionSupported(Version::GL300)) {
const char* extension; GLuint index = 0;
while((extension = reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, index++)))) { const char* extension;
auto found = futureExtensions.find(extension); while((extension = reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, index++)))) {
if(found != futureExtensions.end()) { auto found = futureExtensions.find(extension);
_supportedExtensions.push_back(found->second); if(found != futureExtensions.end()) {
extensionStatus.set(found->second._index); _supportedExtensions.push_back(found->second);
extensionStatus.set(found->second._index);
}
}
/* OpenGL 2.1 doesn't have glGetStringi() */
} else {
vector<string> extensions = Corrade::Utility::split(reinterpret_cast<const char*>(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);
}
} }
} }

Loading…
Cancel
Save