OpenGL Programming/Installation/Mac

From Wikibooks, open books for an open world
< OpenGL Programming
Jump to: navigation, search

In Mac OS X 10.4 (and most likely all versions of OS X) OpenGL and GLUT are installed with the Xcode/developer tools that came on your Mac OS X installation disc(s).

To use GLUT and OpenGL from within Xcode:

  • open Xcode located in "/Developer/Applications/"
  • choose "New Project" from the file menu
  • choose "Command Line Tool" under the Application template for Mac OS X
  • choose type "C++"
  • enter your desired project name and directory
  • from the "Action" menu (which has a picture of a small gear on it) select "Add -> Existing Frameworks"
  • frameworks are stored in "/System/Library/Frameworks/", from there select and add GLUT & OpenGL

When #including OpenGL & GLUT header files (but not the regular ones like iostream) within Xcode, make sure to do so like this:

#include <OpenGL/gl.h>
#include <OpenGl/glu.h>
#include <GLUT/glut.h>

in other words:

#include <name_of_framework/name_of_header_file.h>