Properly restore previous context

_glfwPlatformShowWindow(window) and _glfwPlatformUnhideWindow(window)
implicitly make the context of window current on OS X Yosemite, which
undoes _glfwPlatformMakeContextCurrent(previous).  To properly restore
the previous context, we call _glfwPlatformMakeContextCurrent(previous)
just before glfwCreateWindow() returns.
This commit is contained in:
Chi-kwan Chan 2015-04-26 06:27:59 -04:00
parent 5b6e67119f
commit d43776502b

View File

@ -238,9 +238,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
glClear(GL_COLOR_BUFFER_BIT);
_glfwPlatformSwapBuffers(window);
// Restore the previously current context (or NULL)
_glfwPlatformMakeContextCurrent(previous);
if (wndconfig.monitor)
{
int width, height;
@ -262,6 +259,9 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
}
}
// Restore the previously current context (or NULL)
_glfwPlatformMakeContextCurrent(previous);
return (GLFWwindow*) window;
}