Compiling Opengl/Glut Programs

On Mac OS X using XCode

 
OpenGL is an integral part of OS X -- all of the proper libraries (Frameworks) are already built into the OS.  To create an OpenGL/Glut program --
  1. Open up Project Builder.
  2. Go to File -> New Project.  Select Cocoa Application (or select C++ Tool for a bare-bones C++ application.)
  3. Name the project whatever you want.
  4. Go to Project -> Add Frameworks and add the GLUT.framework and the OpenGL.framework. 
  5. If you created a Cocoa Application, delete the file "main.m" from the "Other Sources" directory. Also delete "Other Frameworks" from Frameworks.
  6. If you created a C++ Tool, delete main.cpp from the Sources directory.
  7. Add your OpenGL and/or GLUT *.cpp and *.h files to the Classes directory. 
  8. If your OpenGL program files have the include library <GL/glut.h>, change this to <GLUT/glut.h>. If you are including <gl.h> and/or <glu.h>, you'll need to change them to <OpenGL/gl.h> and/or <OpenGL/glu.h>
  9. Build the program and run it.