Cleanup of context clearing during window destruction.
This commit is contained in:
parent
b87157ccc1
commit
467d501621
@ -969,9 +969,6 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
|||||||
[window->NSGL.pixelFormat release];
|
[window->NSGL.pixelFormat release];
|
||||||
window->NSGL.pixelFormat = nil;
|
window->NSGL.pixelFormat = nil;
|
||||||
|
|
||||||
if ([NSOpenGLContext currentContext] == window->NSGL.context)
|
|
||||||
[NSOpenGLContext clearCurrentContext];
|
|
||||||
|
|
||||||
[window->NSGL.context release];
|
[window->NSGL.context release];
|
||||||
window->NSGL.context = nil;
|
window->NSGL.context = nil;
|
||||||
|
|
||||||
|
@ -528,11 +528,6 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
|
|
||||||
void _glfwDestroyContext(_GLFWwindow* window)
|
void _glfwDestroyContext(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
// This is duplicated from glfwDestroyWindow
|
|
||||||
// TODO: Stop duplicating code
|
|
||||||
if (window == _glfwCurrentWindow)
|
|
||||||
_glfwPlatformMakeContextCurrent(NULL);
|
|
||||||
|
|
||||||
if (window->WGL.context)
|
if (window->WGL.context)
|
||||||
{
|
{
|
||||||
wglDeleteContext(window->WGL.context);
|
wglDeleteContext(window->WGL.context);
|
||||||
|
@ -947,8 +947,16 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
// we're just creating an OpenGL 3.0+ context with the same pixel
|
// we're just creating an OpenGL 3.0+ context with the same pixel
|
||||||
// format, but it's not worth the added code complexity
|
// format, but it's not worth the added code complexity
|
||||||
|
|
||||||
|
// First we clear the current context (the one we just created)
|
||||||
|
// This is usually done by glfwDestroyWindow, but as we're not doing
|
||||||
|
// full window destruction, it's duplicated here
|
||||||
|
_glfwPlatformMakeContextCurrent(NULL);
|
||||||
|
|
||||||
|
// Next destroy the Win32 window and WGL context (without resetting or
|
||||||
|
// destroying the GLFW window object)
|
||||||
destroyWindow(window);
|
destroyWindow(window);
|
||||||
|
|
||||||
|
// ...and then create them again, this time with better APIs
|
||||||
if (!createWindow(window, wndconfig, fbconfig))
|
if (!createWindow(window, wndconfig, fbconfig))
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -483,8 +483,8 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow handle)
|
|||||||
if (window == NULL)
|
if (window == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Clear the current context if this window's context is current
|
// The window's context must not be current on another thread when the
|
||||||
// TODO: Re-examine this in light of multithreading
|
// window is destroyed
|
||||||
if (window == _glfwPlatformGetCurrentContext())
|
if (window == _glfwPlatformGetCurrentContext())
|
||||||
_glfwPlatformMakeContextCurrent(NULL);
|
_glfwPlatformMakeContextCurrent(NULL);
|
||||||
|
|
||||||
|
@ -619,8 +619,6 @@ void _glfwDestroyContext(_GLFWwindow* window)
|
|||||||
|
|
||||||
if (window->GLX.context)
|
if (window->GLX.context)
|
||||||
{
|
{
|
||||||
// Release and destroy the context
|
|
||||||
glXMakeCurrent(_glfwLibrary.X11.display, None, NULL);
|
|
||||||
glXDestroyContext(_glfwLibrary.X11.display, window->GLX.context);
|
glXDestroyContext(_glfwLibrary.X11.display, window->GLX.context);
|
||||||
window->GLX.context = NULL;
|
window->GLX.context = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user