3D Underwater World (using OpenGL and SDL)

Copyright Tristan Aubrey-Jones January 2008.

This is an example OpenGL SDL application which creates an animated 3D underwater world (screenshot), with "Thunderbird 4" with headlights moving on a spline path, a randomly generated sand terrain, sunken ship/submarine/treasure chest models, and swaying fish and seaweed. It is designed to demonstrate basic OpenGL features, and the structure is as follows:

global.h

home Home   up Up   ( Download )


#ifndef GLOBAL_H_INCLUDED #define GLOBAL_H_INCLUDED // libraries needed for OpenGL drawing #include #include #include #include // debugging or release? //#define DEBUG #ifdef DEBUG #define BIRDSEYE //#define SIDEON #endif // settings #define SUN_X 25.0 #define SUN_Y 70.0 #define SUN_Z 25.0 #ifndef DEBUG #define VISIBLE_DISTANCE 100.0 #define SUN_INTENSITY 0.7 #else #define VISIBLE_DISTANCE 200.0 #define SUN_INTENSITY 0.9 #endif // constants const GLfloat PI = 3.14159265; // size of display area const int SCREEN_WIDTH = 640; const int SCREEN_HEIGHT = 480; #endif