Free OpenGL MDI example
Click here to go to the OpenGL MDI example

Skybox & Lens Flare


By Alan Baylis 20/10/2002




A skybox is a very impressive addition to a game as a backdrop. This example is the simplest version that would be possible. They can be rendered using more textures or extend to using a textured sphere instead. About the only important consideration is to make the coordinates of the skybox relative to the camera position. As the camera moves then the skybox coordinates must be recalculated to move with it so that it is impossible for the camera to ever actually reach the skybox.
A lens flare doesn't actually occur with the human eye but anything that adds to the amount of visual feedback to the player is worth the slight anomaly. The lens flare uses a modified version of Yossarian King's demo source. The main change was to use my texture class rather than his RAW textures but there are a few other changes in there as well. To add a bit more realism to the demo I have also added a glare to the sun that changes intensity depending on how close to the center of the screen the sun is.

To learn how to use the source code read my comments in main.cpp.

Above Content Copyright © 1998 - 2005 Alan Baylis, All Rights Reserved