# gl3.h on Mac OS X Lion

**URL:** <https://discourse.glfw.org/t/gl3-h-on-mac-os-x-lion/262>\
**Category:** support\
**Created:** [November 18, 2011, 3:42pm UTC](https://discourse.glfw.org/t/gl3-h-on-mac-os-x-lion/262 "2011-11-18T15:42:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [November 18, 2011, 3:42pm UTC](https://discourse.glfw.org/t/gl3-h-on-mac-os-x-lion/262/1 "2011-11-18T15:42:00Z")

</div>

**[zoologies](https://sourceforge.net/u/zoologies/)** wrote on [Friday, November 18, 2011](https://sourceforge.net/p/glfw/discussion/247562/thread/f91e84be/#894b):

Hi,  
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,  
GLFW\_OPENGL\_CORE\_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!  
Thanks,

Jon

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [November 20, 2011, 10:36pm UTC](https://discourse.glfw.org/t/gl3-h-on-mac-os-x-lion/262/2 "2011-11-20T22:36:18Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Sunday, November 20, 2011](https://sourceforge.net/p/glfw/discussion/247562/thread/f91e84be/#268b):

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [November 20, 2011, 10:38pm UTC](https://discourse.glfw.org/t/gl3-h-on-mac-os-x-lion/262/3 "2011-11-20T22:38:58Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Sunday, November 20, 2011](https://sourceforge.net/p/glfw/discussion/247562/thread/f91e84be/#96fa):

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

[http://glfw.svn.sourceforge.net/viewvc/glfw/trunk/include/GL/glfw.h](http://glfw.svn.sourceforge.net/viewvc/glfw/trunk/include/GL/glfw.h)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [November 29, 2011, 12:00pm UTC](https://discourse.glfw.org/t/gl3-h-on-mac-os-x-lion/262/4 "2011-11-29T12:00:43Z")

</div>

**[zoologies](https://sourceforge.net/u/zoologies/)** wrote on [Tuesday, November 29, 2011](https://sourceforge.net/p/glfw/discussion/247562/thread/f91e84be/#a001):

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [November 29, 2011, 1:10pm UTC](https://discourse.glfw.org/t/gl3-h-on-mac-os-x-lion/262/5 "2011-11-29T13:10:01Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Tuesday, November 29, 2011](https://sourceforge.net/p/glfw/discussion/247562/thread/f91e84be/#d07c):

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [December 2, 2011, 1:41pm UTC](https://discourse.glfw.org/t/gl3-h-on-mac-os-x-lion/262/6 "2011-12-02T13:41:34Z")

</div>

**[zoologies](https://sourceforge.net/u/zoologies/)** wrote on [Friday, December 02, 2011](https://sourceforge.net/p/glfw/discussion/247562/thread/f91e84be/#4028):

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [December 3, 2011, 9:39am UTC](https://discourse.glfw.org/t/gl3-h-on-mac-os-x-lion/262/7 "2011-12-03T09:39:58Z")

</div>

**[zoologies](https://sourceforge.net/u/zoologies/)** wrote on [Saturday, December 03, 2011](https://sourceforge.net/p/glfw/discussion/247562/thread/f91e84be/#4ebc):

To answer my own question (see: [http://www.opengl.org/wiki/OpenGL\_Loading\_  
Library):](http://www.opengl.org/wiki/OpenGL_Loading_Library%29:) setting  
glewExperimental = true before calling glewInit solves the problem (kind  
of), however following initialisation glGetError returns 1280 (before  
calling any gl commands).

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [December 3, 2011, 4:03pm UTC](https://discourse.glfw.org/t/gl3-h-on-mac-os-x-lion/262/8 "2011-12-03T16:03:28Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Saturday, December 03, 2011](https://sourceforge.net/p/glfw/discussion/247562/thread/f91e84be/#5c53):

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [December 5, 2011, 11:19am UTC](https://discourse.glfw.org/t/gl3-h-on-mac-os-x-lion/262/9 "2011-12-05T11:19:32Z")

</div>

**[zoologies](https://sourceforge.net/u/zoologies/)** wrote on [Monday, December 05, 2011](https://sourceforge.net/p/glfw/discussion/247562/thread/f91e84be/#4295):

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.
