Articles » Amiga OS 4 Articles » OpenGL/MiniGL Templates » Full-Screen GLUT

Full-Screen GLUT

The same rotating triangle as previous templates, but on its own screen.
The same rotating triangle as in previous templates, but full-screen.

Sometimes it is preferable to run a 3D application in its own screen, particularly for games. The first time that I wanted to do this, it took a surprizingly long time to find the documentation required, particularly considering that obtaining full-screen operation requires only 1-2 lines of code. This template has two different methods of opening a full-screen. These can be found in files GLUT-fullscreen.c, and GLUT-fullscreen2.c. The makefile will build both examples.

This template includes a project file for Visual Studio 2008 (i.e., Windows), and a makefile for Amiga OS 4.x+. Users of other systems should be able to modify the makefile for their systems easily.

Learn more about programming in OpenGL. Click here. 

GLUT Game-Mode (GLUT-fullscreen.c)

GLUT game-mode opens a screen of specific resolution and properties (e.g., bit-depth). The advange of this method over the other one is that it offers more control over the screen's properties. This advantage is somewhat diminished on Amiga OS, since its concept of screens is different from other operating-systems. More about that later.

Achieving full-screen using the game-mode requires removing the glutCreateWindow() call, and replacing it with two new lines of code. For example:


The first line specifies the desired screen properties. GLUT will try to match those. It is possible to suggest a refresh-rate too, but this is currently ignored by MiniGL (the graphics drivers do not give you that option). The second line opens the full-screen window. Leaving GLUT game mode is achieved simply by calling glutLeaveGameMode().

GLUT Full-Screen (GLUT-fullscreen2.c)

The other method of switching to full-screen is simply to call glutFullScreen() after opening the window. Exiting full-screen and returning to a window view can be achieved by calling glutReshape(). 

So why have two separate methods of switching to full-screen? Well, the specification for glutFullScreen() simply states that the image should cover the complete screen. In many systems, this means enlarging the window to cover the whole screen, and making it borderless. GLUT game-mode, on the other hand, allows specifying the resolution of the display. The reason for this implementation probably stems from the fact that most systems have no concept of multiple screens like the Amiga does. MiniGL  on Amiga OS 4 opens a separate screen in both cases. For glutFullScreen(), it tries to choose the screen-mode that most closely matches the original window.


NOTE: For Amiga OS users/developers, this template requires features that are only available in MiniGL 2.0 or better. 

Articles » Amiga OS 4 Articles » OpenGL/MiniGL Templates » Full-Screen GLUT