glutLeaveGameMode

I am having some problems using glutLeaveGameMode(). I am trying to be able to switch between full screen and a windowed view. I can enter into game mode, but I can’t leave gameMode with out having my program crash. The code is currently:

case ‘f’:
if( glutGameModeGet( GLUT_GAME_MODE_ACTIVE ) == 0 )
{
glutGameModeString(“800x600:16@60”);
if (glutGameModeGet(GLUT_GAME_MODE_POSSIBLE))
glutEnterGameMode();
initWindow();
}
else if( glutGameModeGet( GLUT_GAME_MODE_ACTIVE ) != 0 )
{
glutLeaveGameMode();
}
break;

When I leave the program, I do exit out of GameMode first, and that call to glutLeaveGameMode seems to work fine. I ran across a post from about a year ago that stated:

Yup, you leave game mode, but you dont leave the program. Either
a: put exit(0); after the glutLeaveGameMode()

or

b: go back into a window.

I think my problem has something to do with part b, but I am not sure what this person meant. If anyone can tell me how I would go about going back to a window, I would appreciate it.

-Drew

I have figured this out, I think. glutSetWindow( someWindow ) appears to be working. If there is a better way to do this please let me know.

-Drew