c++openglglutfreeglutglutcreatewindow

OpenGL /GLUT Creating window after mainEventLoop()


I am developing a game in OpenGL/GLUT and I need to open a new window to show the score when the game is won.

In order to do this, i will call glutCreateWindow() and register the callbacks after calling mainEventLoop().

Is there a problem with this ? How should I do it properly ?


Solution

  • Is there a problem with this?

    Yes.

    Why don't you simply draw the results in the same window as the game?

    Why are you using GLUT in the first place? It's not a very good framework for games. Better use GLFW or SDL.

    How should I do it properly ?

    By adding a small GUI system to your engine, that allows you to overlay the screen with stats (like a HUD) and a score screen.