Created
March 7, 2013 17:59
-
-
Save tluyben/5110198 to your computer and use it in GitHub Desktop.
OpenPandora GLES return Null for the version; workaround
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Parses the client API version string and extracts the version number | |
// | |
static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev) | |
{ | |
int i, _api = GLFW_OPENGL_API, _major, _minor = 0, _rev = 0; | |
const char* version; | |
const char* prefixes[] = | |
{ | |
"OpenGL ES-CM ", | |
"OpenGL ES-CL ", | |
"OpenGL ES ", | |
NULL | |
}; | |
/* version = (const char*) glGetString(GL_VERSION); | |
if (!version) | |
{ | |
_glfwInputError(GLFW_PLATFORM_ERROR, | |
"Failed to retrieve context version string"); | |
return GL_FALSE; | |
} | |
for (i = 0; prefixes[i]; i++) | |
{ | |
const size_t length = strlen(prefixes[i]); | |
if (strncmp(version, prefixes[i], length) == 0) | |
{ | |
version += length; | |
_api = GLFW_OPENGL_ES_API; | |
break; | |
} | |
} | |
if (!sscanf(version, "%d.%d.%d", &_major, &_minor, &_rev)) | |
{ | |
_glfwInputError(GLFW_PLATFORM_ERROR, | |
"No version found in context version string"); | |
return GL_FALSE; | |
} | |
*/ | |
_api = GLFW_OPENGL_ES_API; | |
_major = 1; | |
_minor = 1; | |
*api = _api; | |
*major = _major; | |
*minor = _minor; | |
*rev = _rev; | |
return GL_TRUE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment