Activate OpenGL and GLSL on Xcode

In this page, I will demonstrate how to activate OpenGL and GLSL in Xcode.
I use Intel Iris pro graphics and OpenGL 4.1 check your OpenGL version in Xcode (version 7.2).

Type this commend in Mac terminal to know your version of Xcode.

/usr/bin/xcodebuild -version

Step 1: Download framworks and library for OpenGL


Build GLFW with Cmake.

After we download GLFW,we use Cmake to generate project files or makefiles and compile it by makefiles to get the GLFW library.

Build GLEW libraries.

Unlike GLFW, we just need to make install it. Go to the directoy of glew-2.0.0 and type sudo make install in your mac terminal. Because I extracted glew-2.0.0.zip on my desktop, I go to the glew-2.0.0 by cd ~/desktop/glew-2.0.0 .

   cd ~/desktop/glew-2.0.0 
   sudo make install

After installing GLEW, it shows this information in terminal. We have the header files of GLEW which are in the /usr/local/include/GLand the libraries of GLFW which are in the /usr/local/lib/

screen shot 2017-04-05 at 4 11 01 am

Build Glm libraries.

Because Glm doesn’t have makefile, we need to generate its makefile by Cmake `

Step 2: Check head files and libraries whether are in your environment or not.

Step 3: Open a new Porject on Xcode.

In this step, we start to open a new OpenGL project and GLSL on Xcode. Xcode is an integrated development environment(IDE) for macOS. We will use Cocoa application on OSX to activate GLSL.

Step 4: Edit your main.cpp on Xcode.

If you have nay questions, please let me know. I am glad to help you! :blush: