You don't need GLEW on OS X. All supported OpenGL functions are declared in header files that are included with the standard development environment. If you want to see what header files are present, and what they contain, the exact location of the header files is explained in this answer: Where are the OpenGL header files located on MacOSX?. You don't normally have to worry about the path name, the compiler will find the right one automatically if you include it with a name like <OpenGL/gl3.h>
.
For GLFW, you had the right include sequence in your question:
#define GLFW_INCLUDE_GLCOREARB
#include <GLFW/glfw3.h>
What you were missing based on the discussion in the comments is that you need the GLFW_INCLUDE_GLCOREARB
define every time before you include <GLFW/glfw3.h>
.
When you develop cross platform code, needing conditional includes for each platform in every source file that contains OpenGL calls is cumbersome to maintain. A simple approach to make life easier is to keep the system dependent includes in a single header, and then include that header in your source files. This isolates the system dependencies, and will make it much easier to for example add a platform later.
For example, you could define a header named gl_includes.h
, which includes the system dependent OpenGL includes, like you have it in your code:
#ifdef WIN32
#include ...
#endif
#ifdef ...
#include ...
#endif
Then, in all your source files, you only include this header:
#include "gl_includes.h"