PDA

View Full Version : GLUT and Close window



nexusone
11-04-2002, 05:22 PM
I have been using Lcc-win32 to write my programs, but have had this bug.
If I close the window with the close window [X] it keeps running in the back ground.

Any ideas as to why?

Deiussum
11-05-2002, 05:30 AM
Are you using threads? What are you using to create the Windows?

nexusone
11-05-2002, 05:38 AM
I am using GLUT and glutCreateWindow then I go into glutmainloop.



Originally posted by Deiussum:
Are you using threads? What are you using to create the Windows?

Deiussum
11-05-2002, 05:44 AM
Hmm... I've seen this happen at times if you <EDIT>don't</EDIT> properly handle the WM_DESTROY and WM_QUIT messages when using Win32, but I've never seen it happen with Glut. It can also happen if you start up a new thread somewhere that keeps running after the window closes. It doesn't sound like you are doing either, though.

[This message has been edited by Deiussum (edited 11-05-2002).]

nexusone
11-05-2002, 05:49 AM
I do use glutIdleFunc and glutTimerFunc..
could they maybe cause it?

I have the source code on my webpage, two of my programs..
http://www.angelfire.com/linux/nexusone/index.html



Originally posted by Deiussum:
Hmm... I've seen this happen at times if you <EDIT>don't</EDIT> properly handle the WM_DESTROY and WM_QUIT messages when using Win32, but I've never seen it happen with Glut. It can also happen if you start up a new thread somewhere that keeps running after the window closes. It doesn't sound like you are doing either, though.

[This message has been edited by Deiussum (edited 11-05-2002).]



[This message has been edited by nexusone (edited 11-05-2002).]

Deiussum
11-05-2002, 06:59 AM
I don't think glutIdleFunction and glutTimerFunction actually use a separate thread. The idle function is called when there are no window messages to process, and the timer function is called when there is a timer function.

I'm out of ideas. Unless maybe the version of glut you are using with LCC-win32 has some bug where it's not handling WM_DESTROY properly. That's just a wild guess, though, and probably not too likely.

Deiussum
11-05-2002, 09:59 AM
I just tried compiling and running your simple glut window demo and didn't see the behavior you described. (I did have to add #include <string.h> in order to get the prototype for strlen, but other than that it compiled fine.)

If that's one that you are having problems with, then I would have to say it has something to do with your development environment and not the code. It sounds like you probably already thought that was the problem, but it never hurts to double check the code as well.