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

Game Mode
[OpenGLUT API Reference]


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.

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:

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.

Varies in behavior; X users can disable the resolution change by an OpenGLUT compile-time option.

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.

pname The parameter value to be returned
pname is one of:

    Return non-zero if we are presently in gamemode.

    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.

    Return the game mode width. (in pixels)

    Return the game mode height. (in pixels)

    Return the game mode pixel depth. (in bits)

    Return the game mode vertical refresh frequency. (in Hz)

    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.



See also:
glutGameModeString(), glutEnterGameMode(), glutLeaveGameMode(), glutGameModeGet()

void glutGameModeString const char *  string  ) 

Set the game mode display string.

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

See also:
glutGameModeString(), glutEnterGameMode(), glutLeaveGameMode(), glutGameModeGet()

void glutLeaveGameMode void   ) 

Leave game mode, returning to normal desktop mode.

See also:
glutGameModeString(), glutEnterGameMode(), glutLeaveGameMode(), glutGameModeGet()

OpenGLUT Development @ Sourceforge
Homepage | Summary | Files | CVS | Forums | Lists | Bugs | RFE

Generated on Sat Feb 5 01:47:29 2005 for OpenGLUT by doxygen
The OpenGLUT project is hosted by