Fixed printing of GLFW version on usage and error.

This commit is contained in:
Camilla Berglund 2015-06-30 18:36:33 +02:00
parent 5f91ea34de
commit a7fa41612c

View File

@ -172,16 +172,8 @@ static void list_extensions(int api, int major, int minor)
static GLboolean valid_version(void) static GLboolean valid_version(void)
{ {
int major, minor, revision; int major, minor, revision;
glfwGetVersion(&major, &minor, &revision); glfwGetVersion(&major, &minor, &revision);
printf("GLFW header version: %u.%u.%u\n",
GLFW_VERSION_MAJOR,
GLFW_VERSION_MINOR,
GLFW_VERSION_REVISION);
printf("GLFW library version: %u.%u.%u\n", major, minor, revision);
if (major != GLFW_VERSION_MAJOR) if (major != GLFW_VERSION_MAJOR)
{ {
printf("*** ERROR: GLFW major version mismatch! ***\n"); printf("*** ERROR: GLFW major version mismatch! ***\n");
@ -191,10 +183,22 @@ static GLboolean valid_version(void)
if (minor != GLFW_VERSION_MINOR || revision != GLFW_VERSION_REVISION) if (minor != GLFW_VERSION_MINOR || revision != GLFW_VERSION_REVISION)
printf("*** WARNING: GLFW version mismatch! ***\n"); printf("*** WARNING: GLFW version mismatch! ***\n");
printf("GLFW library version string: \"%s\"\n", glfwGetVersionString());
return GL_TRUE; return GL_TRUE;
} }
static void print_version(void)
{
int major, minor, revision;
glfwGetVersion(&major, &minor, &revision);
printf("GLFW header version: %u.%u.%u\n",
GLFW_VERSION_MAJOR,
GLFW_VERSION_MINOR,
GLFW_VERSION_REVISION);
printf("GLFW library version: %u.%u.%u\n", major, minor, revision);
printf("GLFW library version string: \"%s\"\n", glfwGetVersionString());
}
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
int ch, api, major, minor, revision; int ch, api, major, minor, revision;
@ -328,6 +332,8 @@ int main(int argc, char** argv)
} }
} }
print_version();
glfwWindowHint(GLFW_VISIBLE, GL_FALSE); glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
window = glfwCreateWindow(200, 200, "Version", NULL, NULL); window = glfwCreateWindow(200, 200, "Version", NULL, NULL);