Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
OpenPandora GLES return Null for the version; workaround
// 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