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. 13
      src/Context.cpp

13
src/Context.cpp

@ -165,6 +165,7 @@ 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 */
if(isVersionSupported(Version::GL300)) {
GLuint index = 0; GLuint index = 0;
const char* extension; const char* extension;
while((extension = reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, index++)))) { while((extension = reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, index++)))) {
@ -175,6 +176,18 @@ Context::Context() {
} }
} }
/* 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);
}
}
}
/* Set this context as current */ /* Set this context as current */
CORRADE_ASSERT(!_current, "Context: Another context currently active", ); CORRADE_ASSERT(!_current, "Context: Another context currently active", );
_current = this; _current = this;

Loading…
Cancel
Save