I know that tracking OpenGL errors is a pain, but I have noticed that
glfwSwapBuffers() throws an error when the window is closed. It is a small
issue, nevertheless. The code is something like this:
while (running == 1){
glfwGetWindowSize(&screen_width, &screen_height);
resize(screen_width, screen_height);
display();
glFlush();
er = glGetError();
glfwSwapBuffers();
er = glGetError();
if (er != GL_NO_ERROR){
_handle_error_("\nOpenGL error : %i", er);
}
glFinish();
glfwSleep(0.05);
// Checks is the window is still active
running = glfwGetWindowParam( GLFW_OPENED );
}
You may right. If I write
er = glGetError();
er = glGetError();
I still get the same error… Very weird
I suppose that glfwSwapBuffers is where the context is destroyed, and there
any OpenGL error check should be done after that.
By default, glfwSwapBuffers calls glfwPollEvents after having swapped the
actual buffers and, also by default, when the user attempts to close the
window, it just gets closed.
Since GLFW treats the window and context as a unit, the GLFW_OPENED window
parameter also indicates whether or not there is a context.