mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 12:02:00 +00:00
Cleanup.
This commit is contained in:
parent
2a255e49e2
commit
45d528baed
@ -35,9 +35,9 @@
|
||||
|
||||
// Parses the client API version string and extracts the version number
|
||||
//
|
||||
static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev)
|
||||
static GLboolean parseVersionString(int* api, int* major, int* minor, int* rev)
|
||||
{
|
||||
int i, _api = GLFW_OPENGL_API, _major, _minor = 0, _rev = 0;
|
||||
int i;
|
||||
const char* version;
|
||||
const char* prefixes[] =
|
||||
{
|
||||
@ -47,6 +47,8 @@ static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev)
|
||||
NULL
|
||||
};
|
||||
|
||||
*api = GLFW_OPENGL_API;
|
||||
|
||||
version = (const char*) glGetString(GL_VERSION);
|
||||
if (!version)
|
||||
{
|
||||
@ -62,23 +64,18 @@ static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev)
|
||||
if (strncmp(version, prefixes[i], length) == 0)
|
||||
{
|
||||
version += length;
|
||||
_api = GLFW_OPENGL_ES_API;
|
||||
*api = GLFW_OPENGL_ES_API;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sscanf(version, "%d.%d.%d", &_major, &_minor, &_rev))
|
||||
if (!sscanf(version, "%d.%d.%d", major, minor, rev))
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"No version found in context version string");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
*api = _api;
|
||||
*major = _major;
|
||||
*minor = _minor;
|
||||
*rev = _rev;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
@ -379,10 +376,10 @@ GLboolean _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
|
||||
{
|
||||
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
|
||||
|
||||
if (!parseGLVersion(&window->context.api,
|
||||
&window->context.major,
|
||||
&window->context.minor,
|
||||
&window->context.revision))
|
||||
if (!parseVersionString(&window->context.api,
|
||||
&window->context.major,
|
||||
&window->context.minor,
|
||||
&window->context.revision))
|
||||
{
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user