closing glut windows from within code

Im having trouble working out how to do this?
I have a glut window which is being opened from within my code (a simulation of sorts) this window then displays the required output etc, but then how do i close this window when im done with it, and cause the program control flow to return to the code which first created the glut window?
All ive managed so far is either for the window just to stay, and program flow not to return to my code, or, for the whole program to quit out, both of which are not acceptable. So any help is greatly appreciated



glutCreateWindow() returns a window id.

glutSetWindow(id) sets the window with “id” to be drawn. so when u close the render window set ur normal window.

hope my answer was not ambiguous.


Try glutDestroyWindow( id ).