Fixed order of operations.

This commit is contained in:
Camilla Berglund 2012-09-23 14:08:36 +02:00
parent d6d5fb2684
commit 718af531a3

View File

@ -336,8 +336,9 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
// Cache the actual (as opposed to requested) window parameters // Cache the actual (as opposed to requested) window parameters
_glfwPlatformRefreshWindowParams(window); _glfwPlatformRefreshWindowParams(window);
// Cache the actual (as opposed to requested) context parameters
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
// Cache the actual (as opposed to requested) context parameters
if (!_glfwRefreshContextParams()) if (!_glfwRefreshContextParams())
{ {
glfwDestroyWindow(window); glfwDestroyWindow(window);
@ -353,6 +354,11 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
return GL_FALSE; 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) // Restore the previously current context (or NULL)
glfwMakeContextCurrent(previous); glfwMakeContextCurrent(previous);
@ -361,12 +367,7 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
if (mode == GLFW_FULLSCREEN) if (mode == GLFW_FULLSCREEN)
glfwSetInputMode(window, GLFW_CURSOR_MODE, GLFW_CURSOR_CAPTURED); glfwSetInputMode(window, GLFW_CURSOR_MODE, GLFW_CURSOR_CAPTURED);
// Clearing the front buffer to black to avoid garbage pixels left over if (mode == GLFW_FULLSCREEN || wndconfig.visible)
// from previous uses of our bit of VRAM
glClear(GL_COLOR_BUFFER_BIT);
_glfwPlatformSwapBuffers(window);
if (wndconfig.visible || mode == GLFW_FULLSCREEN)
glfwShowWindow(window); glfwShowWindow(window);
return window; return window;