From 8247e6069d4561f2d7342a6014471bc3b8b4833f Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 2 Jun 2015 03:26:02 +0200 Subject: [PATCH] Fixed mode setting for tearing test. --- tests/tearing.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/tearing.c b/tests/tearing.c index 1b65e76d..f93acbec 100644 --- a/tests/tearing.c +++ b/tests/tearing.c @@ -92,7 +92,7 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action, int main(int argc, char** argv) { - int ch; + int ch, width, height; float position; unsigned long frame_count = 0; double last_time, current_time; @@ -120,9 +120,27 @@ int main(int argc, char** argv) exit(EXIT_FAILURE); if (fullscreen) - monitor = glfwGetPrimaryMonitor(); + { + const GLFWvidmode* mode; - window = glfwCreateWindow(640, 480, "", monitor, NULL); + monitor = glfwGetPrimaryMonitor(); + mode = glfwGetVideoMode(monitor); + + glfwWindowHint(GLFW_RED_BITS, mode->redBits); + glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); + glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); + glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); + + width = mode->width; + height = mode->height; + } + else + { + width = 640; + height = 480; + } + + window = glfwCreateWindow(width, height, "", monitor, NULL); if (!window) { glfwTerminate();