PDA

View Full Version : close glut window



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

Thanx.

Rob The Bloke
12-04-2000, 03:24 AM
try...

glutDestroyWindow( int handle);

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

Alessandro Melzi
03-15-2005, 04: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.

RigidBody
03-15-2005, 04: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, 04:59 AM
Thanks, but how I can remove glutDisplayFunc? Thanks a lot.

RigidBody
03-15-2005, 05: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)
return;

// draw your stuff
}

RigidBody
03-15-2005, 05: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, 05: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?

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

jide
03-20-2005, 10: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 ;)