'Toggle Full Screen' function and using glutEnterGameMode();

Yeah, I’m having a problem getting my program to do this correctly. I’m trying to write a ‘toggle full screen’ function for my program where it kills the window that was created using glutCreateWindow(“window title”); and displays my program in fullscreen using glutEnterGameMode(); Don’t know if this is even the correct way, but obviously, it’s not, because it kills my entire program when I run the code, and I get these command line errors as well:

GLUT: Warning in C:\DIR\OF\PROGRAM\PROGRAM.EXE: The following is a new check for GLUT 3.0; update your code.
GLUT: Fatal Error in C:\DIR\OF\PROGRAM\PROGRAM.EXE: redisplay needed for window 1, but no display callback.

Here’s what my code looks like:

if (glutGameModeGet(GLUT_GAME_MODE_POSSIBLE)) {
glutDestroyWindow(hWnd);;
glutEnterGameMode();
}

…where hWnd is the value returned by glutCreateWindow(“window title”); and I’m using GLUT 3.7.6.

What am I doing wrong here?

[This message has been edited by rpxmaster (edited 09-20-2002).]

I haven’t used glutGameMode at all, but that 2nd error looks suspiciously like you forgot to define a display callback with glutDisplayFunc.

Hi,
I have been using fullscreen mode with my OGL/GLUT programming for the past month. What is the glutGameMode and how is it different from regular fullscreen mode?

This message is the 2nd reference to this I have read today.

Thanks,
ChuckB

Are you talking about the difference between glutGameMode and glutFullscreen, or glutGameMode and ChangeScreenResolution functions, whatever they’re called?

Anyways, I did define my glutDisplayFunc sometime before I called glutDestroyWindow() function. Is there something else that I’m supposed to do, or what is it? I’m still having this problem.

…anyone?

I do not remember the exact syntax off the top of my head but there are a lot of good tutorials at Nehe’s web site. The tutorials are usually written for Windows but there are ports for Glut.

Try Lesson02 at http://nehe.gamedev.net/tutorials/lesson.asp?l=02. Just look at the bottom of the page and there is a GameGlut example.

Hope this helps,
jpummill

As far as I understand, the ports on NeHe’s web site toggle between glutCreateWindow and glutFullscreen. I do know there is code for glutGameMode, but I don’t believe it’ll let you go out of it, into glutCreateWindow. I need one that can go between glutCreateWindow and glutGameMode, if this is even possible.