This directory contains program that support the third edition of the OpenGL Primer.
They are organized by chapter. Each directory contains the source code relevant to that
Because under Mac OSX the GLUT header files are stored in the GLUT include rather than GL as on other systems,
I have added the following compiler directive to each program so each should compile without
modification on all architectures
If you compile and link your code from a command line, then the following Makefile should
work on most linux systems. Use the LDLIBS line that fits your X11 installation.
C = gcc
#LDLIBS = -lglut -lGL -lGLU -lXmu -lX11 -lm
LDLIBS = -lglut -lGL -lXmu -lX11 -lm -L/usr/X11R6/lib -I/usr/X11R6/include
$(CC) $@.c $(LDLIBS) -o $@
For Mac OS X, the following is a minimal Makefile for Mac OS X
GL_OPTIONS=-framework OpenGL -framework GLUT
gcc $@.c $(OPTIONS) -o $@
Using the proper makefile, you should be able to comile a single program myprogram.c by
For Windows platforms, if you write your own shaders, you will also have to install the
GLEW libraries from sourceforge.com. Then add the include
and the intialization
after the glutInitWindow call.