OpenGL ® SuperBible, Fourth Edition, begins by illuminating the core techniques of “classic” OpenGL graphics programming, from drawing in space to geometric transformations, from lighting to texture mapping. The authors cover newer OpenGL capabilities, including OpenGL 2.1’s powerful programmable pipeline, vertex and fragment shaders, and advanced buffers. They also present thorough, up-to-date introductions to OpenGL implementations on multiple platforms, including Windows, Mac OS X, GNU/Linux, UNIX, and embedded systems. The book contains 1248 pages of invaluable information for beginners and advanced OpenGL programmers.

Recommended by the author of this tutorial

I have gone through a number of tutorials on the Internet (from NeHe to a bunch of others) to numerous books written on the subject of OpenGL. One of the most informative OpenGL books was the OpenGL SuperBible, also known as "The Blue Book" by the people who work in the industry. This is an absolute must if you are serious about learning OpenGL.
OpenGL - 7 - OpenGL base-code digression
BACK TO TUTORIALS
JUMP TO - gl0 - gl1 - gl2 - gl2.5 - gl3 - gl4 - gl5 - gl6 - gl7 - gl8 -
This tutorial is a little digression from the OpenGL subject. This tutorial needs to be here because I want to explain what, at this point, the base code is turning into. As it's not contained within a single header and a single cpp files anymore, an explanation is required of how files are linked together. Moreover, you need to know how to add additional modules of code to the current code structure if you decide to append something to the base code by yourself. So, here is how files are linked together in the fallout openGL base code:
; The main include file "glbase.h":

glbase.h---+- <windows.h>
           +- <gl/gl.h>
            +- <gl/glu.h>
             +- "defined.h"
              +- "log.h"
               +- "winmain.h"
                +- "model.h"
                 +- "system.h"
                 +- "glmain.h"
                 +- "dierr.h"
                 +- "directinput.h"

;Each of the following *.cpp files #includes "glbase.h":

dierr.cpp        :  DirectInput error codes
directinput.cpp  :  DirectInput implementation
glmain.cpp       :  the "main()" function
log.cpp          :  system log
model.cpp        :  [*.m] format model definition
system.cpp       :  'system' stuff; SysShutdown, SysSetDisplayMode...
winmain.cpp      :  WinMain(); and initialization

Whenever you want to add your own module of code, for example a 3D math library, given that your math library is contained within math3d.h and math3d.cpp files, you would go to "glbase.h" and append the line #include "math3d.h" (indicated in red below) at the end of the already included files list:
// glbase.h

#include 		// Windows crap...

#include 		// openGL headers
#include 

#include "defined.h"		// main defined types
#include "log.h"		// system log

#include "winmain.h"		// WinMain(), InitOpenGL()
#include "model.h"		// model file (filename.m) definition
#include "system.h"		// SysShutdown(), Sys...
#include "glmain.h"		// RenderFrame()

#include "dierr.h"		// DirectInput error codes
#include "directinput.h"	// DirectInput implementation

#include "math3d.h"		// your 3D math library

You would then add the line #include "glbase.h" at the beginning of your math3d.cpp file. Recompile the code. Now you can use your math library from within any other file included in glbase.h. That simple.

JUMP TO - gl0 - gl1 - gl2 - gl2.5 - gl3 - gl4 - gl5 - gl6 - gl7 - gl8 -
OpenGL - 7 - OpenGL base-code digression
BACK TO TUTORIALS



Fallout Software | OpenGL Light Tutorial Index