c++ - glfwDestroyWindow won't close window -
i have program opengl running in secondary thread. if render loop done, call glfwdestroywindow(). however, window won't close before exit main thead. if try close several times (by repeatedly clicking on x), window pops says window not responding , asks me force quit.
why glfwdestroywindow not close window?
edit: way, using glfw3.
edit2:
this how code looks like, basically. can see output while window still open. window closed when either force close or exit main thread.
main thread:
int main() { startopenglthread(); while(1); } opengl thread:
window::start() { initglfw(); while(!glfwwindowshouldclose()); glfwdestroywindow(); cout << "i can see ouput, window still open!" << endl; } edit3:
the window closes if put glfwterminate() right behind output, obviously. however, not want, because may have other windows opened.
you need call glfwpollevents() or glfwwaitevents() close button event processed. insert 1 glfwwaitevents(); loop , window should close properly.
Comments
Post a Comment