Game Development Reference
In-Depth Information
The glutReshapeFunc function is called when FreeGLUT detects that the applic-
ation window has changed its shape. This is necessary for the graphics system (and
sometimes game logic) to know the new screen size and it's up to us to make im-
portant changes to the scene to handle all possibilities.
If FreeGLUT determines that the current window needs to be redrawn, the
glutDisplayFunc function is called. Sometimes Windows detects that an applica-
tion window is in a damaged state, such as when another window has been partially
obscuring it, and this is where this function might be called. We would typically just
re-render the scene here.
The glutIdleFunc function fills the role of the typical update of game applications.
It is called when FreeGLUT is not busy processing its own events, giving us time to
perform our own game logic instructions.
More information about these functions can be found in the FreeGLUT documenta-
tion at:
Initializing FreeGLUT
Finally, we need to configure our application window before FreeGLUT can launch it
for us. This is done through the following function calls:
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA |
glutInitWindowPosition(0, 0);
glutInitWindowSize(width, height);
Search WWH ::

Custom Search