GLUT Game Mode

Hi all,
I was wondering if anyone has any advice for using glut game mode. When I try it, the screen fades to black, then fades back in again and I get the following error:

2002-12-20 03:47:38.287 a.out[2250] GLUT Warning: The following is a new check for GLUT 3.0; update your code.
2002-12-20 03:47:38.289 a.out[2250] GLUT Fatal Error: redisplay needed for window 2, but no display callback.

How do I fix this?

Thanks a bunch,
Gabe

Install a display function for your second window using glutDisplayFunc… are you using glutCreateWindow as well as glutEnterGameMode in the same program? You’ll need to set up the display functions for both, in that case (can be the same function).

Yeah, I’m at the moment using them both. Is that a bad idea? I’m pretty new to GLUT. I tried commenting out all the GLUT create window stuff, but I get bus errors when I try and run it. How do I set the display function on a per window basis? Thanks,

Gabe

Originally posted by OneSadCookie:
Install a display function for your second window using glutDisplayFunc… are you using glutCreateWindow as well as glutEnterGameMode in the same program? You’ll need to set up the display functions for both, in that case (can be the same function).

If you only want fullscreen, you can replace the standard glutCreateWindow call with glutEnterGameMode, and everything should work.

Otherwise, you need to understand a bit about how the GLUT window model works. At any given time, one window is “current”. There are GLUT calls to get and set the current window, and creating a window (through either glutCreateWindow or glutEnterGameMode) makes the new window current.

Each window must have a display function and a resize function set for it. You set the display and resize functions for a window by calling glutDisplayFunc and glutReshapeFunc while the window is current.

If you call glutMainLoop() or return to it from an event handler, and you have a window which doesn’t have both of those two functions set for it, you get the error you have described.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.