OpenGLUT 0.6.3 development - OpenGLUT: Game Mode
Keywords: OpenGLUT, FreeGLUT, OpenGL, GLUT, X11, Windows, Programming, Documentation, Download, Development, Sourceforge

OpenGLUT Documentation
Introduction | Documentation | Examples | Proposals | Authors | Copying | Todo | Bugs | Links

# Game Mode
[OpenGLUT API Reference]

## Functions
int | glutEnterGameMode (void)
int | glutGameModeGet (GLenum pname)
void | glutGameModeString (const char *string)
void | glutLeaveGameMode (void)

## Detailed Description

Game mode provides an exclusive full-screen mode of operation for applications such as games.

Game mode suffers from some serious problems, however.

Todo:
  It behaves differently on different systems. E.g., on some X systems, changing the video mode is impossible. This has led some developers to use game mode as a ``grab the mouse'' mode, without intending a resolution change.

  Replacing game mode with a better design was discussed at some length in early 2004.

  There is no way for game mode to report a partial failure.

  There is no way to guarantee cleanup if OpenGLUT crashes during game mode---or if the client crashes or directly exits, etc.

  Some XFree86 releases, with some drivers, can fail to set the video mode properly, resulting in disasterous failure (an unusable display). This is presently somewhat headed off by a compile-time option, but a runtime option would be better, as there may be cases where the user is willing to put up with the risk for some---and only some---OpenGLUT applications. Since game mode applications are somewhat dim-witted about such user preferences, it seems, an OpenGLUT runtime control could be desirable.

One idea was to decompose gamemode into component parts and implement them separately, where each part then either succeeds totally or fails totally:

- Resolution change.
- Fullscreen.
- Focus grabbing.
- Settable video frequencies at current resolution.

Applications could ask for any or all of these separately. Some of this is already apparently intended in unimplemented API entry points inherited from freeglut. However, the meaning of the entry points is undocumented.

## Function Documentation

int glutEnterGameMode | ( | void |  | ) |

| Enter game mode. Any combination of the following may apply: Resolution change, possibly to the requested resolution, possibly to a "nearest match". Refresh frequency change. A window with a drawable area equal to the requested screen resolution will be opened. The mouse may be restricted to operate within your window. Note: Varies in behavior; X users can disable the resolution change by an OpenGLUT compile-time option. Todo: Documentation OpenGLUT may be unable to restore the original settings (this has been observed on WIN32). See also: glutGameModeString(), glutEnterGameMode(), glutLeaveGameMode(), glutGameModeGet()

int glutGameModeGet | ( | GLenum | pname | ) |

  | Return the value of a game mode parameter. Parameters:
  | pname | The parameter value to be returned
pname is one of: GLUT_GAME_MODE_ACTIVE Return non-zero if we are presently in gamemode. GLUT_GAME_MODE_POSSIBLE Return whether the requested gamemode settings are viable. (May also actually change the mode?) Does not necessarily tell you whether entering gamemode will have any effect. GLUT_GAME_MODE_WIDTH Return the game mode width. (in pixels) GLUT_GAME_MODE_HEIGHT Return the game mode height. (in pixels) GLUT_GAME_MODE_PIXEL_DEPTH Return the game mode pixel depth. (in bits) GLUT_GAME_MODE_REFRESH_RATE Return the game mode vertical refresh frequency. (in Hz) GLUT_GAME_MODE_DISPLAY_CHANGED Return non-zero if we are presently in gamemode. (Same as GLUT_GAME_MODE_ACTIVE.) If pname is unknown, a warning is printed and a value of -1 is returned. Todo: Documentation OpenGLUT intrepretation of GLUT_GAME_MODE_DISPLAY_CHANGED See also: glutGameModeString(), glutEnterGameMode(), glutLeaveGameMode(), glutGameModeGet()

void glutGameModeString | ( | const char * | string | ) |

  | Set the game mode display string. Parameters:
  | string | A configuration parameter as a string.
Sets the gamemode status according to an undocumented string. Glancing at old GLUT 3.7, the freeglut codebase that we inherited does not implement more than a single GLUT gamemode ``criteria''. It may not even do that much correctly. In principle, this code lets you set the video dimensions, rendering depth, and video refresh rate. In practice, the combination that you request may be unsupportable and the target host may even refuse to honor any such changes. If you use this function but do not set all options, the following defaults may be substituted for some values: width 640 height 480 depth 16 refresh 72 Todo: Documentation See also: glutGameModeString(), glutEnterGameMode(), glutLeaveGameMode(), glutGameModeGet()

void glutLeaveGameMode | ( | void |  | ) |

| Leave game mode, returning to normal desktop mode. Todo: Documentation See also: glutGameModeString(), glutEnterGameMode(), glutLeaveGameMode(), glutGameModeGet()

OpenGLUT Development @ Sourceforge
Homepage | Summary | Files | CVS | Forums | Lists | Bugs | RFE
Generated on Tue Oct 5 18:44:33 2004 for OpenGLUT by doxygen 1.3.8
The OpenGLUT project is hosted by sourceforge.net.