From 718af531a332ca876b9438ece39ccab1cdbf11f2 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 23 Sep 2012 14:08:36 +0200 Subject: [PATCH] Fixed order of operations. --- src/window.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/window.c b/src/window.c index 817691de..383662af 100644 --- a/src/window.c +++ b/src/window.c @@ -336,8 +336,9 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height, // Cache the actual (as opposed to requested) window parameters _glfwPlatformRefreshWindowParams(window); - // Cache the actual (as opposed to requested) context parameters glfwMakeContextCurrent(window); + + // Cache the actual (as opposed to requested) context parameters if (!_glfwRefreshContextParams()) { glfwDestroyWindow(window); @@ -353,6 +354,11 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height, return GL_FALSE; } + // Clearing the front buffer to black to avoid garbage pixels left over + // from previous uses of our bit of VRAM + glClear(GL_COLOR_BUFFER_BIT); + _glfwPlatformSwapBuffers(window); + // Restore the previously current context (or NULL) glfwMakeContextCurrent(previous); @@ -361,12 +367,7 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height, if (mode == GLFW_FULLSCREEN) glfwSetInputMode(window, GLFW_CURSOR_MODE, GLFW_CURSOR_CAPTURED); - // Clearing the front buffer to black to avoid garbage pixels left over - // from previous uses of our bit of VRAM - glClear(GL_COLOR_BUFFER_BIT); - _glfwPlatformSwapBuffers(window); - - if (wndconfig.visible || mode == GLFW_FULLSCREEN) + if (mode == GLFW_FULLSCREEN || wndconfig.visible) glfwShowWindow(window); return window;