Setting Up In XCode

  • Create new Command Line Tool

GLUT

  • Click on your project name then click on Build Phases
  • Click ‘Link Binary With Libraries
  • Click the + button
  • Type OpenGL in the search box, Click OpenGL.framework, then click Add
  • Click the + button again
  • Type glut in the search box, Click GLUT.framework, then click Add

Remove Depreciation Warnings (GLUT OpenGL files have been depreciated)

  • Click the Build Settings tab
  • In the search bar on the top right of the tab, type deprecated
  • Under Apple LLVM – Warnings – All Languages, look for “Deprecated Functions” setting
  • Change the setting to “No”

Include libraries in your project

  • select main.c
  • add the following files:
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>

Done!

GLFW

Downloading GLFW & GLEW

  1. download GLFW & GLEW
  2. unzip both
  3. create new project - your base OpenGL project
  4. put GLEW & GLFW inside new project folder
  5. create 'build' folder inside glfw folder
  6. Open CMake. input GLFW location, and put output as glfw/build folder
  7. Open newly created GLFW project in glfw/build

    1. change the scheme ALL_BUILD to "install"
    2. Click the Run button.
  8. Open terminal, cd to GLEW folder, "sudo make install"

    1. GLEW libraries are now in glew/lib, and GLEW include files are in glew/include
  9. Open your base OpenGL project > Build Phases > Link Binary w\/ libraries:

    1. OpenGL.framework
    2. libGLEW. ------, in /usr/local/lib
    3. libglfw. -------, in ... look for it...
  10. Go to Build settings> search paths>

    1. HEADER search paths: \/usr\/local\/include
    2. LIBRARY Search paths: \/usr\/local\/lib
  11. Still under Build settings, go to Linking> Other Linker Flags, add -lGLEW

  12. #include <GL\/glew.h>

  13. #include <GLFW\/glfw3.h>

Adding GLFW & GLEW To Your Project

  1. Create new project
  2. Copy and paste GLFW & GLEW folders from base project
  3. Open your OpenGL project > Build Phases > Link Binary w\/ libraries:

    1. OpenGL.framework
    2. libGLEW. ------, in /usr/local/lib (the most recently created)
    3. libglfw. --------, in /usr/local/lib (the most recently created)
  4. Go to Build settings> search paths>

    1. HEADER search paths: \/usr\/local\/include

    2. LIBRARY Search paths: \/usr\/local\/lib

  1. still under Build settings, go to Linking> Other Linker Flags, add -lGLEW
  2. #include <GL\/glew.h>
  3. #include <GLFW\/glfw3.h>

results matching ""

    No results matching ""