GLUT for Mac

Installing GLUT

There is no need to install GLUT on a Mac. It comes as part of the package. If you have XCode, you can make a GLUT application. YAY!

Set up a GLUT program

  1. Start XCODE
  2. Create a New Project
  3. Select Command Line Utility from the list on the left
  4. Select the icon for C++ Tool on the right (Select Standard Tool if you are coding in C)
  5. Click Choose...
  6. Name your project, choose a location, and click Save
  7. Replace main.cpp with the lab template or with the sample code you want to try out.
    For new projects, you can start from this GLUT template.
  8. Right click on the project group in "Groups and Files" and click Add | Existing Frameworks...
  9. Add both the OpenGL and GLUT frameworks.
  10. NOTE: Most GLUT examples on the web are targeted at Windows or Linux. Make sure GLUT is included via #include <GLUT/GLUT.h>. There is no need to include gl.h or glu.h in a glut project.

Please note that while GLUT is very easy to use and wonderfully cross platform it is a bit buggy (eg. try resizing in a direction that strictly shrinks the window...) and feature limited. You will want to use something better maintained (SDL) or write your own window management code for best results.