Compiling OpenGL Outside the Lab
You are allowed to develop code on your own machine, instead of the
lab machines. However, you must ensure that your code compiles and
runs on the lab machines for grading (with the exception of the final
project). You must do this before the project is due, don't put it off
until the last minute!
Note that it is up to you to configure your home machine so that it
works. To make your lives a bit easier, we're providing the
information based on the experience of past students. If you have
additions or corrections, let us know.
OpenGL should be default-installed on everything (Linux/Windows/Macs).
You will need to install GLUT yourself on Windows and Linux.
- Windows:
- Macs:
- GLUT should already be installed on your Mac, as described
here.
- The only code difference on the Mac is the #include statement
for GLUT, which makes portability a one-line-change operation. Change
#include <GL/glut.h> to #include <GLUT/glut.h>
- To work from the command line, you will just need to modify your
Makefile. Change the -lGL -lGLU -lglut flags to -framework GLUT
-framework OpenGL -framework Foundation.
-
To run the projects in Xcode, follow the actions taken in this screencast [2:18]. The video is summarized here:
- Create a new C++ Project. Select File > New Project, then Mac OS X - Application - Command Line Tool.
- Drag in the existing files and remove the generated main.cpp
- Link the libraries by selecting the project name in the left pane then "Build Phases" in the middle pane. Once there, expand Link Binary with Libraries and add OpenGL.framework and GLUT.framework.
- If you need to copy over resources to the build directory (e.g. obj files), add a build phase for copying files to destination Resources and add the files there.
- If you need to specify command line arguments, select Product > Edit Scheme... and add them under "Arguments Passed On Launch."
- Linux:
See also the detailed instructions from USC.
Back to 314
Last modified: Mon Jan 14 17:04:17 PST 2013