PDA

View Full Version : exiting glutEnterGameMode crashes some PCs?



BlueJ
06-02-2001, 07:06 PM
My Voodoo 3 system will run applications fine in fullscreen mode but then it performs an illegal operation when exit(0); is executed. A Geforce 2 system has no problem. Anyone encountered anything like this?



glutGameModeString("800x600:32");
if (glutGameModeGet(GLUT_GAME_MODE_POSSIBLE)) glutEnterGameMode();

[This message has been edited by BlueJ (edited 06-02-2001).]

Binqay
06-04-2001, 06:02 AM
I have the same problem too. I'm using Vodoo3 2000. I've try glutLeaveGameMode but it still crash when exit. It's also crash on Matrox 200. I haven't test on GeForce yet.

From my experience, it'll crash if I set glutGameModeString with different resolution from the current desktop resolution.

So, here's my idea but it's not tested yet. Switch to fullscreen using glutFullScreen(). Get the current desktop resolution and save it to any variable. Then set our desire resolution. Before exit, reset the resolution to previous setting.

Here's the pseudecode:
glutFullScreen();
a = glutGameModeGet(currentResolution);
glutGameModeString(ourDesireSetting);
glutEnterGameMode(...);

//before exit
glutGameModeString(a);
glutEnterGameMode(...);
exit(0);

This code may looks 'ugly' but it may be works. If you solve this problem either using my idea or not, please put a BIG TITLE so I won't miss it! http://www.opengl.org/discussion_boards/ubb/smile.gif

BlueJ
06-04-2001, 03:25 PM
Thanks, I forgot about glutLeaveMode()! I had commented out the whole function and ended up writing a new one but with exit(0) by itself (which caused the crash). I can never seem to keep my code looking clean when learning new material http://www.opengl.org/discussion_boards/ubb/smile.gif

glutLeaveGameMode();
exit(0);

If that is crashing your system, I wonder if its because you are using both glutFullScreen() and glutEnterGameMode(). Isn't that redundant?

Binqay
06-06-2001, 04:01 AM
Yes,they look redundant to me too but I'm not using both glutFullscreen and glutGameMode at one time yet, it's just an idea.

The idea is to set fullscreen using glutFullscreen so I can get the current desktop resolution, bit & fps. With glutGameModeString, it will change the desktop resolution to our setting and will cause crash on some PC when exit because the screen resolution is not reset to default. So the default resolution which we get after the glutFullscreen can be passed to glutGameModeString before exit.

This 'weird' idea come out because I think glutLeaveMode is not enough for my PC to reset to default setting.

P/S: Does your problem settled just using the glutLeaveMode command? Have your ever try on older card like Matrox 200?

fathom
06-06-2001, 09:47 AM
I'm just now starting to use GLUT. Can you change your resolution (game mode) in the fly? Like say you've got a 640x480 and you want it to chnge to 800x600, what commands would I need to issue and what do I need to be concerned with as far as the openGL state is concerned? Thanks! (My GLUT docs are only for 3.0 -- anybody know where the latest DOCs could be found?)