gl3.h on Mac OS X Lion

zoologies wrote on Friday, November 18, 2011:

I’m trying to get some code working using glfw in “Core Profile” mode on Mac
OS X Lion (10.7.2), which enables OpenGL 3.2. I can get everything set up
using glfwOpenWindowHint(GLFW_OPENGL_PROFILE,
However, according to Apple you need to include gl3.h not gl.h in core profile
mode. However as far as I can tell glfw is only including gl.h. I can manually
include gl3.h but this generates warnings about incompatible modes.

I’m also having trouble getting glBindFragDataLocation to work correctly
(necessary to bind the fragment shader output colour to the frame buffer - at
this is only defined in gl3.h). If anyone can point me to a GL 3.2 example
working under Lion (e.g. one that doesn’t use any immediate mode calls,
matrix stack, etc.)) it would be much appreciated!


elmindreda wrote on Sunday, November 20, 2011:

This is a known problem. GLFW 2.7.3, which will be released shortly,
introduces the GLFW_INCLUDE_GL3 macro, which will make glfw.h include gl3.h
instead of gl.h.

elmindreda wrote on Sunday, November 20, 2011:

Until then, you can use this version of glfw.h:

zoologies wrote on Tuesday, November 29, 2011:

Thanks for the reply! I downloaded the svn version and installed it and
defined the GLFW_INCLUDE_GL3 & GLFW_NO_GLU macros. While this is good, I
think this means you can’t select at run time if you want to run in
compatibility or core profile mode anymore.

elmindreda wrote on Tuesday, November 29, 2011:

If you need to choose at runtime then you should use something like GLEW
instead of the regular OpenGL headers.

zoologies wrote on Friday, December 02, 2011:

Unfortunately GLEW doesn’t handle the 3.2 core profile correctly on Mac OS
10.7 when using glfw. For example glGenVertexArrays is NULL with glew and
glfw, but if I run glewinfo | fgrep glGenVertexArrays, I get:
glGenVertexArraysAPPLE: OK
glGenVertexArrays: OK

zoologies wrote on Saturday, December 03, 2011:

To answer my own question (see:
glewExperimental = true before calling glewInit solves the problem (kind
of), however following initialisation glGetError returns 1280 (before
calling any gl commands).

elmindreda wrote on Saturday, December 03, 2011:

GLEW doesn’t work properly with the core profile. This is due to the way GLEW
queries extensions and has nothing to do with GLFW.

zoologies wrote on Monday, December 05, 2011:

There also seems to be a problem with GLFW in core profile mode when trying to
do fullscreen. I get the following error:
invalid pixel format attribute
NSMapGet: map table argument is NULL
when trying to open a window using Core Profile hints.