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 );
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
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:
How do you know that the error is caused by glfwSwapBuffers if you don't check
the value of er before calling it?
Because I call glGetError() above, which clears all previous error messages
from OpenGL.
This is true. My bad.
Which platform is this? Which version of GLFW are you using?
I am using glfw-2.7 on a Windows XP sp3. The graphic card is an Nvidia 6600,
compatible up to GL 2.0
The error is likely due to the fact that you're calling glGetError after the
context has been destroyed.
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.
Yes.
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.