PDA

View Full Version : Glut program exit



maxsteel
06-25-2002, 09:25 AM
I would like to run some deinitialization code before the program exits, but after the user 'closes' the glut window.

Is there a way to catch when the user closes the main glut window?

Thanks!

Jeffry J Brickley
06-25-2002, 10:05 AM
Not sure about a cross platform way, I haven't used GLUT in years now. But on a windows platform you can use atexit() or _onexit(), you can look them up in your MSDEV help. atexit() seems to be ANSI C from the documentation, so that should work on any ANSI C compiler.

int atexit( void ( __cdecl *func )( void ) );

Routine
atexit
Required Header
<stdlib.h>
Compatibility
ANSI, Win 95, Win NT


[This message has been edited by Jeffry J Brickley (edited 06-25-2002).]

jmathies
06-25-2002, 10:25 AM
Originally posted by maxsteel:
I would like to run some deinitialization code before the program exits, but after the user 'closes' the glut window.

Is there a way to catch when the user closes the main glut window?

Thanks!

There are patches - see The OpenGL Toolkit FAQ (http://www.mathies.com/glfaq/\")

Regards,
Jim

maxsteel
06-25-2002, 03:06 PM
thanks. that is just what i was looking for. http://www.opengl.org/discussion_boards/ubb/smile.gif

seems silly that glut does not have the close window callback at least.

Its really annoying when you create multiple windows to display various views & when the user closes one of these windows, the program exits.

Rob Fletcher
06-26-2002, 01:03 AM
Yes, annoying, which is why I wrote the
window manager close callbacks!

You will have to build your own glut though,
from source and include the new code.

I have emailed Nate and Mark K to see if we can get a revised GLUT out to everyone, but
have not had any reply from either ...

Let me know if you find the code useful ...

Rob.

oh yes, info at

http://www-users.york.ac.uk/~rpf1/glut/html

John Nagle
07-25-2002, 06:43 PM
Any word from Nate?

It's a real problem that GLUT, used by many people, is both unsupported and under a license that doesn't permit modification by others.
Should we switch to FreeGLUT?

cthulhu666
07-25-2002, 11:59 PM
What is the state of FreeGlut anyway, there hasn't been a new release since January?

John Nagle
07-26-2002, 08:42 AM
Originally posted by cthulhu666:
What is the state of FreeGlut anyway, there hasn't been a new release since January?
They think they're done. Nothing more to do.
And they're not answering.

Rob Fletcher put in a request to put his window-close-callback code in FreeGlut, and nobody answered.

ldglite
07-29-2002, 07:32 AM
>>What is the state of FreeGlut anyway, there hasn't been a new release
>>since January?
>
>They think they're done. Nothing more to do.
>And they're not answering.
>
>Rob Fletcher put in a request to put his window-close-callback code in
>FreeGlut, and nobody answered

Look here:

http://sourceforge.net/mail/?group_id=1032

The freeglut developer mailing list is monitored, and there has been
*some* development activity since the last release. However I'm not
sure anyone looks at the SourceForge Feature Request Tracking System
where that request was posted.

I investigated using freeglut for my project a few months ago but ran
into quite a few missing features. Now my code does things that you
wouldn't normally do in a game project (like single buffered mode) so
maybe it works fine for other folks. I get the impression that it
works ok for whatever the developers use it for, so they're probably
not all that motivated to change it. Perhaps someone with time and
motivation should join the developer team and crank things up. They
let me in, so my patches will eventually make it into the CVS
archives.

John Nagle
08-01-2002, 08:29 PM
Originally posted by ldglite:


Look here:

http://sourceforge.net/mail/?group_id=1032

The freeglut developer mailing list is monitored, and there has been
*some* development activity since the last release. However I'm not
sure anyone looks at the SourceForge Feature Request Tracking System
where that request was posted.




You can't post to any of the FreeGLUT forums unless you're a FreeGLUT developer. Somebody was spamming the FreeGLUT developer list (in an Asian font, even), so they seem to have locked down their lists.

John Nagle
08-02-2002, 08:01 AM
Is there some way to jumpstart this fix? Any ideas?

So much OpenGL usage involves GLUT; it can't just be abandoned without impacting OpenGL itself.