Archive for October 12th, 2005

Administrator

Creating OpenGL Programs in Xcode V2.1

Compiling Opengl/Glut Programs

On Mac OS X using XCode v2.1

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 (Do not select C++ Tool for a barebones C++
application.)

-Name the project whatever you want.
Go to Project -> Add To Project… and add the GLUT.framework and the OpenGL.framework.
(located under /System/Library/Frameworks NOT /Library/Frameworks) Stick these Frameworks
under “Frameworks” in your project. Or right click on the Frameworks folder in your Project
and go to Add ->Existing Frameworks…

-Delete the file “main.m” from the “Other Sources” directory. Also delete “Other Frameworks” from
Frameworks. Be sure to only delete the references and not the actual files.

-Add your OpenGL and/or GLUT *.cpp and *.h files to the Classes directory. You can do this by
Highlighting your Classes folder and selecting Action -> Add -> Existing Files

-If your OpenGL program files have the include library , change this to .
If you are including and/or , you’ll need to change them to and/or
respectively.

-Build the program and run it.

*Note – If you get a “signal 10 (SIGBUS) Error” then you are not selecting “Cocoa Application” when
you creat your new project.