Foundations of 3D Computer Graphics
Mac Setup
- GLUT should be already installed in Mac OS X.
- Download GLEW source package from the web (grab the .tgz package instead of the .zip package, since shell scripts in the zip package have Windows end-of-line symbols, which might confuse the default OS X shell), compile (by typing make), and install (by typing make install).
Now your computer should be ready to build and run the cs 175 code.
To build OpenGL programs, you will have to include the OpenGL, GLUT, and GLEW header files as well as link against the correct library files. The main difference in compiling them is that under Mac OS X, you do not need to tell the compiler where the include files and libraries for GL and GLUT are, but instead simply add options "-framework OpenGL" and "-framework GLUT" during the linking phase.
Compiling and Linking with OpenGL Support
- In your main source file, remember to #include <GL/glew.h> and #include <GLUT/glut.h>
- When linking, add the options "-framework OpenGL" and "-framework GLUT" to tell the linker that these are used. For example, you can do this by adding the line: "LDFLAGS += -framework OpenGL -framework GLUT" to your Makefile.