How to close and reopen a GLUT window in a loop?

我与影子孤独终老i 提交于 2019-12-11 14:04:43

问题


I am doing a simple OpenGL freeglut project where I need to close an OpenGL window and when given a command, reopen it in the initial state (Like a game staring again when the replay button is pressed). I want to do something like this -

while (c == 'y') {
    glutDisplayFunc(display);
    glutMouseFunc(mouse);
    glutMainLoop();
    printf ("Want to play again? (y/n)\n");
    scanf ("%c", &c);
}

How can I do this? I saw about glutDestroyWindow() somewhere but couldn't figure out how to use that in my case.

来源:https://stackoverflow.com/questions/56824776/how-to-close-and-reopen-a-glut-window-in-a-loop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!