Started with single GLRC for GLXContext.

This commit is contained in:
Lukas Hermanns 2018-04-25 14:20:33 +02:00
parent d873ed69fb
commit 68d0c63865

View File

@ -237,8 +237,15 @@ static void destroyContextGLX(_GLFWwindow* window)
}
if (window->context.glx.handle)
{
#ifdef _GLFW_OPENGL_SINGLE_GLRC
if (window->context.customctx)
{
glXDestroyContext(_glfw.x11.display, window->context.glx.handle);
}
#else
glXDestroyContext(_glfw.x11.display, window->context.glx.handle);
#endif
window->context.glx.handle = NULL;
}
}
@ -495,6 +502,25 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
_glfwGrabErrorHandlerX11();
#ifdef _GLFW_OPENGL_SINGLE_GLRC
if(share)
{
// Use shared context instead of creating a new one
window->context.wgl.handle = share;
window->context.customctx = GLFW_FALSE;
}
else
{
// Create new GL render context
window->context.glx.handle = NULL;
window->context.customctx = GLFW_TRUE;
}
#endif
#ifdef _GLFW_OPENGL_SINGLE_GLRC
if (!window->context.glx.handle)
#endif
{
if (_glfw.glx.ARB_create_context)
{
int index = 0, mask = 0, flags = 0;
@ -602,6 +628,7 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
window->context.glx.handle =
createLegacyContextGLX(window, native, share);
}
}
_glfwReleaseErrorHandlerX11();