mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-27 04:28:52 -05: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
|
// 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* version;
|
||||||
const char* prefixes[] =
|
const char* prefixes[] =
|
||||||
{
|
{
|
||||||
|
@ -47,6 +47,8 @@ static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev)
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
*api = GLFW_OPENGL_API;
|
||||||
|
|
||||||
version = (const char*) glGetString(GL_VERSION);
|
version = (const char*) glGetString(GL_VERSION);
|
||||||
if (!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)
|
if (strncmp(version, prefixes[i], length) == 0)
|
||||||
{
|
{
|
||||||
version += length;
|
version += length;
|
||||||
_api = GLFW_OPENGL_ES_API;
|
*api = GLFW_OPENGL_ES_API;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sscanf(version, "%d.%d.%d", &_major, &_minor, &_rev))
|
if (!sscanf(version, "%d.%d.%d", major, minor, rev))
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"No version found in context version string");
|
"No version found in context version string");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
*api = _api;
|
|
||||||
*major = _major;
|
|
||||||
*minor = _minor;
|
|
||||||
*rev = _rev;
|
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,10 +376,10 @@ GLboolean _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
|
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
|
||||||
|
|
||||||
if (!parseGLVersion(&window->context.api,
|
if (!parseVersionString(&window->context.api,
|
||||||
&window->context.major,
|
&window->context.major,
|
||||||
&window->context.minor,
|
&window->context.minor,
|
||||||
&window->context.revision))
|
&window->context.revision))
|
||||||
{
|
{
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user