Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use glew with XCode

I am trying to use glew 1.10.0 with the latest XCode(5.0.2) an the latest Mac OsX version. So far, I have tried different things:

  • Added the library "libGLEW.1.10.0.dylib" in the Build Phases tab
  • Added the OpenGL Framework in the Build Phases tab
  • Changed the Header search path to "usr/local/Cellar/glew/1.10.0/include"
  • Changed the Library search path to "usr/local/Cellar/glew/1.10.0/lib"
  • Included GL/glew.h with "<>" and ""

I am always getting the error "'GL/glew.h' file not found"

like image 929
y7haar Avatar asked Dec 21 '25 15:12

y7haar


1 Answers

Since there is a single library you link to whether you get the legacy OpenGL 2.1 renderer or a core 3.2+ renderer, GLEW is completely unnecessary on OS X. This means that things from OpenGL 3.2+ will resolve at link-time (before you even have a render context to check whether it is supported or not). If you try to use functions that are not implemented by your renderer at run-time however, you will either get a GL_INVALID_OPERATION error or the operation will silently fail. It is a difference between link-time (OS X) and run-time (Windows, Linux, etc.) resolution of GL functions.

Just include <OpenGL/gl3.h> if you are going to use functionality from OpenGL 3.2+ core on OS X and forget about GLEW. The set of implemented extensions across all hardware OS X officially supports is relatively homogeneous depending more on the renderer version than the actual hardware vendor (Apple writes all of the drivers). You should refer to this matrix that Apple publishes for more details on GL capabilities, rather than relying on GLEW.

like image 131
Andon M. Coleman Avatar answered Dec 24 '25 03:12

Andon M. Coleman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!