I have the freeglut-2.2.0 package, so my file/line
number references pertain to that package.
I tried using the glutSetOption function to set the
GLUT_ACTION_ON_WINDOW_CLOSE option to
GLUT_ACTION_CONTINUE_EXECUTION, but when I ran my
program, it still quit when i closed one window. I
poked around a little in the freeglut source, and think
I've tracked down the problem. At the end of
glutMainLoop, there are a couple lines
(lines 1126-1128 in freeglut_main.c)
if( fgState.ActionOnWindowClose == GLUT_ACTION_EXIT)
The problem is that fgDeinitialize sets
fg.ActionOnWindowClose = GLUT_ACTION_EXIT
on line 271 of freeglut_init.c. So, freeglut always
exits, even if thats not what the user wanted.
This is my first bug report, so I'm not sure if I'm
supposed to make suggestions. Also, this is about as
much as I know about the whole structure of the
freeglut system, so I dont want to mess anything up. It
seems that a quick thing to do to fix the problem would
be right before fgDeinitialize() on line 1126 of
freeglut_main.c, set a boolean flag
flag = (fgState.ActionOnWindowClose == GLUT_ACTION_EXIT);
and then change the
if(fgState.ActionOnWindowClose == GLUT_ACTION_EXIT)
I'm not sure if this is the best solution, but it seems
it should work. Thanks.
Log in to post a comment.