Articles » Amiga OS 4 Articles » OpenGL/MiniGL Templates » Opening a Full Screen in an SDL based OpenGL Application

Opening a Full Screen in an SDL based OpenGL Application

Unlike GLUT, opening a full screen via SDL is so trivial as to make this template almost pointless. Nevertheless, for symmetry with the GLUT templates, here is an SDL based OpenGL template that opens a full screen.

The basic template for using OpenGL with SDL can be changed to open a full screen simply by changing the following line:

screen = SDL_SetVideoMode(WIDTH, HEIGHT, 0, SDL_OPENGL | 
SDL_RESIZABLE);

to:

screen = SDL_SetVideoMode(WIDTH, HEIGHT, 0, SDL_OPENGL | 
SDL_FULLSCREEN);

Yes, that is correct; swapping SDL_RESIZABLE for SDL_FULLSCREEN when creating the SDL surface, is all that is required. Nevertheless, template source-code is provided below, for those who are extremely lazy. 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.

Compiling

Simply download (here) and decompress the archive to a directory. Windows users can open the Visual Studio solution file. Amiga users should open a shell (console) window and enter that directory, and type gmake. Provided that you have the SDK and the MiniGL header files installed, it will compile and produce a binary called GLUT-basic. You can run the template application by typing GLUT-basic and pressing enter. An example of the DOS commands is:

cd SDL-GL-fullscreen
gmake
SDL-GL-fullscreen

Pressing ESCAPE quits the template application.

IMPORTANT: Amiga developers should use gmake, not make, to build this template. 

Download

Want to learn more about OpenGL programming? Click here for OpenGL book recommendations.

Learning More About OpenGL

Whilst online tutorials and template code such as the above are important aids to learning OpenGL programming, having the right books is equally important. A list of recommended books can be found here.

 





Articles » Amiga OS 4 Articles » OpenGL/MiniGL Templates » Opening a Full Screen in an SDL based OpenGL Application