我最近发现了 GLFW,并一直在尝试用它制作一个简单的应用程序,并且想知道 glfwTerminate 和 glfwDestroyWindow。我知道 glfwTerminate 会清除所有仍然打开的窗口,因此从不在主窗口上调用 gflwDestroyWindow 应该是安全的,但我是否仍应在终止之前调用 gflwDestroyWindow 还是这更只是个人偏好?
澄清以下哪些是“更好的”。
auto window = glfwCreateWindow(...);
// Do some things
glfwDestroyWindow(window);
glfwTerminate();
或者
auto window = glfwCreateWindow(...);
// Do some things
glfwTerminate();
最佳答案
All windows remaining when
glfwTerminate
is called are destroyed as well.
您不需要调用 glfwDestroyWindow(window);
。尽管我认为最好分别销毁每个窗口。
关于c++ - 应该始终调用 glfwDestroyWindow 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33025353/