From a7fa41612cdad6433186c6e52c06c173f27662e2 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 30 Jun 2015 18:36:33 +0200 Subject: [PATCH] Fixed printing of GLFW version on usage and error. --- tests/glfwinfo.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tests/glfwinfo.c b/tests/glfwinfo.c index 99be17e7..74379c35 100644 --- a/tests/glfwinfo.c +++ b/tests/glfwinfo.c @@ -172,16 +172,8 @@ static void list_extensions(int api, int major, int minor) static GLboolean valid_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); - if (major != GLFW_VERSION_MAJOR) { 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) printf("*** WARNING: GLFW version mismatch! ***\n"); - printf("GLFW library version string: \"%s\"\n", glfwGetVersionString()); 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 ch, api, major, minor, revision; @@ -328,6 +332,8 @@ int main(int argc, char** argv) } } + print_version(); + glfwWindowHint(GLFW_VISIBLE, GL_FALSE); window = glfwCreateWindow(200, 200, "Version", NULL, NULL);