Nov 12th 2007 07:13 pm Installing GLEW in Mac OS X (Leopard)

Print

I’ve been trying for a while to get GLEW (The OpenGL Extension Wrangler Library) working and finally I did it. I think this could be useful for other people. First let me define the platform this way:

  • MacBook (2GHz Intel Core 2 Duo)
  • Mac Os 10.5 (Leopard)
  • Xcode version 3.0
  • glew 1.4.0

Download the last source files of GLEW (at this moment 1.4.0), be sure to downolad the .tgz file. Don’t try either the compiled or the .zip version of the files, there are some issues with them and apparently the .tgz file is the only one that works (read the newsgroup of GLEW in sourceforge for more information about this).

1. Unziping and untaring the file:

tar zxvf glew-1.4.0-src.tgz

2. Compile the sources from a terminal window:

make

There are some harmless warnings that don’t affect the compilation. Watch for errors, however I didn’t have a single one.

3. Install the binaries (you need superuser permissions):

sudo -s

make install

make clean

The files are copied to /usr/lib and /usr/include/GL.

3. Open Xcode

4. Create a new project (The C++ Tool template is perfect)

5. Right-click on the name of the project and choose Add > existing frameworks…

6. Add to your project GLUT.framework. Also, add the following files and select the option of ‘including the file if necessary’ in the popping-up dialog:

/usr/lib/libGLEW.a and /usr/include/GL/glew.h

7. Include the following lines in your code (e.g., main.cpp):

#include <glew.h>
#include <GLUT/glut.h>

8. Go to Project > Edit Project settings. In the pop-up window:

a) Select in Configuration tab: All configurations
b) Select in Architectures tab: i386 (you might need to change this according to your machine).

c) In Valid Architectures, delete all the existing architectures and leave only i386.
d) In ‘Other Linker Flags’ add this line:
-framework OpenGL -framework GLUT

That’s all. After that you can close the panel, and build, or ‘build and go’ your project and it should work.

I found these links somewhat useful :

http://www.vis.uky.edu/~dnister/Teaching/CS535/macNotes.html

http://www.idevapps.com/forum/showthread.php?t=5951

Print

Posted by julovi / Bitacora

5 Responses to “Installing GLEW in Mac OS X (Leopard)”

  1. Joachim Bengtsson on 20 Oct 2008 at 00:00 #


    I made a real .framework out of GLEW, so that it can be used as any other Mac framework without having to mess around with include paths and stuff. Check it out at: http://thirdcog.eu/apps/frameworks#glew

  2. Dan on 16 Nov 2011 at 12:59 #


    Tried this tutorial on the newest version of GLEW, 1.7.0. But it doesn’t see like it is able to create a framework.

    I follow your tutorial and it seems like everything is working.

    Have you tried this with any of the later versions?

  3. julovi on 29 Nov 2011 at 20:15 #


    no I haven’t I’m sorry, if you find a way, please send me a link, I’d be interested

  4. joysword on 10 Apr 2012 at 19:36 #


    how to add /usr/lib/libGLEW.a and /usr/include/GL/glew.h into my project in Xcode in step 6? usr/ folder is hided by xcode, can’t open it

  5. joysword on 10 Apr 2012 at 19:41 #


    I see. Show hidden files in Finder and then drag it into my project did the job. Thanks anyway.

Trackback URI | Comments RSS

Leave a Reply


− one = 5