View Full Version : close glut window

12-03-2000, 08:44 PM
Does anyone know how to close a Glut opened window from a program without getting out of the program?


Rob The Bloke
12-04-2000, 02:24 AM

glutDestroyWindow( int handle);

12-04-2000, 10:44 PM
Thanx, i'll try.

Alessandro Melzi
03-15-2005, 03:18 AM
Sorry, but You now why I use glutDestroyWindow the program close the Window but give me the segmentation fault error? I must close something before? Thanks.

03-15-2005, 03:34 AM
i'm not absolutely sure, but i guess you should remove any glutDisplayFunc (and other functions which access the gl context) before destroying the window.

Alessandro Melzi
03-15-2005, 03:59 AM
Thanks, but how I can remove glutDisplayFunc? Thanks a lot.

03-15-2005, 04:12 AM
i googled a bit around- it seems that a once registered display func cannot be removed.

you could define a global variable like this:

int window_valid = 1;

void destroy_window() {

// whatever

window_valid = -1;

void display_func() {

if(window_valid == -1)

// draw your stuff

03-15-2005, 04:18 AM
by the way, you do you really want to destroy the window? if you only want it to disappear, you can also use glutHideWindow()

03-19-2005, 04:43 AM
I have a similar problem. When I close the GLUT-window, I get an error, and the programm kills itself. Only If I dont start GLUT, I can close my application. Any idea?

03-19-2005, 05:30 AM
Using a debugger, this crash is resolved in 2 minutes (: It'll show you where there is a crap

03-20-2005, 09:16 AM
Originally posted by Gollum:
Using a debugger, this crash is resolved in 2 minutes (: It'll show you where there is a crapYou love debuggers, isn't it ;)