Fix glewGetExtension on core context

This commit is contained in:
Turo Lamminen 2014-12-22 00:29:59 +02:00
parent c8fea198b3
commit f1aac50e30

View File

@ -5,8 +5,22 @@ GLboolean GLEWAPIENTRY glewGetExtension (const char* name)
const GLubyte* start;
const GLubyte* end;
start = (const GLubyte*)glGetString(GL_EXTENSIONS);
if (start == 0)
if (start == 0) {
/* no extension string, we're probably on a core context
query extensions one at a time */
GLint numExtensions = 0;
int i;
glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
/* glewContextInit should have initialized glGetStringi for us */
for (i = 0; i < numExtensions; i++) {
const GLubyte* extName = glGetStringi(GL_EXTENSIONS, i);
GLuint len = _glewStrLen(extName);
if (_glewStrSame((const GLubyte*) name, extName, len)) {
return GL_TRUE;
}
}
return GL_FALSE;
}
end = start + _glewStrLen(start);
return _glewSearchExtension(name, start, end);
}