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 --
- Open up Project Builder.
- Go
to File -> New Project. Select Cocoa Application (or select
C++ Tool for a bare-bones C++ application.)
- Name the project whatever you want.
-
Go to Project -> Add Frameworks and add the GLUT.framework and the
OpenGL.framework.
- If you created a Cocoa Application, delete the file "main.m" from
the "Other Sources" directory. Also delete "Other Frameworks" from
Frameworks.
- If you created a C++ Tool, delete main.cpp from the Sources
directory.
- Add your OpenGL and/or GLUT *.cpp and *.h files to the Classes
directory.
- 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>
- Build the program and run it.