I am trying to support changing resolution on the fly. It works fine for me 95% of the time, but very occasionally the game crashes with the following error:
GLFW_NO_WINDOW_CONTEXT error
Description : Cannot swap buffers of a window that has no OpenGL or OpenGL ES context
Stacktrace : org.lwjgl.glfw.GLFW.glfwSwapBuffers(GLFW.java:4521)
...
This is significantly more common on less powerful systems; a friend of mine sees this crash consistently.
I haven't been able to find much information about this error and I have no idea what would cause it. I am specifically destroying the old window, creating a new one and setting the context, before I try to render:
GLFW.glfwDestroyWindow(window);
...
window = GLFW.glfwCreateWindow(...);
if (window == 0) {
throw new RuntimeException("Failed to create window");
}
GLFW.glfwMakeContextCurrent(window);
Would you expect this to work, or am I missing something?
EDIT: glSwapBuffers is being called from the same thread, AFTER creating the new window, so I don't understand how this error could come about.
Thanks,
Danjb