#elif TARGET_HOST_MS_WINDOWS
- /* Restore the previously rememebered desktop display settings */
+ /* Restore the previously remembered desktop display settings */
ChangeDisplaySettingsEx( fgDisplay.DisplayName,&fgDisplay.DisplayMode, 0,0,0 );
#endif
displayModes[ i ]->vdisplay,
fgState.GameModeDepth,
( exactMatch ? refresh : fgState.GameModeRefresh ) ) ) {
+ if (!exactMatch)
+ {
+ /* Update the chosen refresh rate, otherwise a
+ * glutGameModeGet(GLUT_GAME_MODE_REFRESH_RATE) would not
+ * return the right values
+ */
+ fgState.GameModeRefresh = refresh;
+ }
+
return i;
}
}
success = GL_FALSE;
EnumDisplaySettings( fgDisplay.DisplayName, -1, &devMode );
- devMode.dmFields |= DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY;
+ devMode.dmFields = 0;
- devMode.dmPelsWidth = fgState.GameModeSize.X;
- devMode.dmPelsHeight = fgState.GameModeSize.Y;
- devMode.dmBitsPerPel = fgState.GameModeDepth;
- devMode.dmDisplayFrequency = fgState.GameModeRefresh;
- devMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY;
+ if (fgState.GameModeSize.X!=-1)
+ {
+ devMode.dmPelsWidth = fgState.GameModeSize.X;
+ devMode.dmFields |= DM_PELSWIDTH;
+ }
+ if (fgState.GameModeSize.Y!=-1)
+ {
+ devMode.dmPelsHeight = fgState.GameModeSize.Y;
+ devMode.dmFields |= DM_PELSHEIGHT;
+ }
+ if (fgState.GameModeDepth!=-1)
+ {
+ devMode.dmBitsPerPel = fgState.GameModeDepth;
+ devMode.dmFields |= DM_BITSPERPEL;
+ }
+ if (fgState.GameModeRefresh!=-1)
+ {
+ devMode.dmDisplayFrequency = fgState.GameModeRefresh;
+ devMode.dmFields |= DM_DISPLAYFREQUENCY;
+ }
switch ( ChangeDisplaySettingsEx(fgDisplay.DisplayName, &devMode, NULL, haveToTest ? CDS_TEST : CDS_FULLSCREEN , NULL) )
{
*/
void FGAPIENTRY glutGameModeString( const char* string )
{
- int width = 640, height = 480, depth = 16, refresh = 72;
+ int width = -1, height = -1, depth = -1, refresh = -1;
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGameModeString" );
);
/* Hopefully it worked, and if not, we still have the default values */
- fgState.GameModeSize.X = width;
- fgState.GameModeSize.Y = height;
- fgState.GameModeDepth = depth;
- fgState.GameModeRefresh = refresh;
+ if ( width > 0 ) fgState.GameModeSize.X = width;
+ if ( height > 0 ) fgState.GameModeSize.Y = height;
+ if ( depth > 0 ) fgState.GameModeDepth = depth;
+ if ( refresh > 0 ) fgState.GameModeRefresh = refresh;
}