PDA

View Full Version : 'Toggle Full Screen' function and using glutEnterGameMode();



rpxmaster
09-20-2002, 08:46 PM
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).]

Deiussum
09-22-2002, 07:53 AM
I haven't used glutGameMode at all, but that 2nd error looks suspiciously like you forgot to define a display callback with glutDisplayFunc.

ChuckB
09-22-2002, 07:38 PM
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

rpxmaster
09-23-2002, 09:28 PM
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.

rpxmaster
10-01-2002, 04:34 PM
...anyone?

jpummill
10-01-2002, 05:04 PM
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

rpxmaster
10-03-2002, 05:40 PM
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.