GLFW: window & contextGLFW 1.0
glfwTerminate
Shuts GLFW down: destroys every window that is still open and frees what GLFW allocated.
Signature
void glfwTerminate(void);
How it works
Call it once at the very end of the program. Windows you forgot to destroy are destroyed here, and so are their OpenGL contexts.
After glfwTerminate, no GLFW function works again until you call glfwInit once more. Any OpenGL object (buffer, texture, shader) belonged to a context that no longer exists, so delete them BEFORE this call if you want to free them cleanly.
Tips & pitfalls
Errors
When the call is invalid it does nothing and sets an error, which glGetError returns:
- GLFW_PLATFORM_ERROR
- The operating system or window system reported a failure; the description says which.
Example
example.cpp
1glDeleteVertexArrays(1, &vao); // free GL objects while the context is alive
2glDeleteProgram(program);
3glfwDestroyWindow(window);
4glfwTerminate();