In my OpenGL program, in order to run it in fullscreen mode, I’m using the GLUT function glutGameModeString(const char *string).
(where ‘string’ specifies the screen width,height,pixelDepth and refresh rate)
To make it working in any system,i need to dynamically determine the screen width and screen height of the host system, prior to making the call to ‘glutGameModeString’ function.
How do I do that?
(I just need to know how to retrieve the screen height and width in windows)
Per the API docs "glutGameModeString: Specify the display mode that should be entered when GameMode is entered. Default is the current display mode of the monitor on which the GameMode screen will be opened. "
Also, have you looked at: glutFullScreen, glutLeaveFullScreen, glutFullScreenToggle?
That’s sometimes not what you want; you may want the size of the working area of the screen (i.e. excluding the taskbar and other similar widgets) in which case something like this will do the job:
SystemParametersInfo (SPI_GETWORKAREA, 0, &workarea, 0);
Both of these have uses other than just for helping with going to and from fullscreen mode; the working area size is particularly useful for setting an upper bound on the largest windowed mode you might wish to support, and can also be used for centering your window properly on the screen.