# gl3.h

**URL:** <https://discourse.glfw.org/t/gl3-h/497>\
**Category:** support\
**Created:** [December 14, 2009, 4:19am UTC](https://discourse.glfw.org/t/gl3-h/497 "2009-12-14T04:19:03Z")\
**Posts on this page:** 8\
**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:** [December 14, 2009, 4:19am UTC](https://discourse.glfw.org/t/gl3-h/497/1 "2009-12-14T04:19:03Z")

</div>

**anonymous** wrote on [Monday, December 14, 2009](https://sourceforge.net/p/glfw/discussion/247562/thread/46b29849/#fe01):

I would like to use gl3.h instead of gl.h with glfw. I tried just going  
through the sources and replacing the include declarations with gl3.h, and  
compiled/installed just fine… but I get a segmentation fault in glClear() in  
\_glfwPlatformOpenWindow() in glfwOpenWindow of /usr/local/lib/libglfw.so.

Should glClear just be available after the gl3.h include or is there something  
more that needs to be done? Has anyone done this?

Is this possible, or am I just peeing up a rope?

---

<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 14, 2009, 9:24am UTC](https://discourse.glfw.org/t/gl3-h/497/2 "2009-12-14T09:24:16Z")

</div>

**[dalfy](https://sourceforge.net/u/dalfy/)** wrote on [Monday, December 14, 2009](https://sourceforge.net/p/glfw/discussion/247562/thread/46b29849/#50f5):

Hi,  
I guess you are using glfw2.6. If you want OpenGL 3 and later you need to use  
the version coming from trunk. It is available in Subversion. It is soon to be  
release candidate so I would say it is stable enough to be used.

---

<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 24, 2009, 8:46pm UTC](https://discourse.glfw.org/t/gl3-h/497/3 "2009-12-24T20:46:28Z")

</div>

**anonymous** wrote on [Thursday, December 24, 2009](https://sourceforge.net/p/glfw/discussion/247562/thread/46b29849/#6659):

I was using 2.7 Lite from the repository. I know it was opengl 3 support, my  
problem was that I want only gl3 support via gl3.h. This is the only way you  
can be sure your code is fully 3.2 Forward compliant.

I eventually got this to work by commenting out some opengl calls in glfw  
openwindow code. This got it to compile on linux, after which I added my own  
init that setup all of the opengl commands using the glfw getproc function.

This allowed me to see that GL\_QUADS had infact been depreciated, along with  
a few other things that weren’t GL3.2+.

I now have a small template program using my modified glfw 2.7 lite and gl3.h,  
that uses no depreciated functionality. All GL3.2+ and GLSL1.50.

Sadly, I’ve tried to get it going on windows now, and after more random  
hacking, the getproc function isn’t working. I think it may because I strait  
up commented out the part of the glfwExtensionSupported that used the  
glGetString function. Not sure if that function is used internally…

Meh, I guess my choices are to stop using glfw, or to go in and try modify the  
source enough to work… it’s getting a bit tiring.

Seems to defeat the purpose of glfw… I’m not getting to work on my game… I’m  
fixing cross-platform issues… Nevermind how cmake on windows is a pain…

\*sigh\* I suppose glfw just isn’t for gl3.h peoples…

I wouldn’t mind it’s current setup for GL3 forward compat profile setup, but  
it doesn’t throw any errors if I try to use depreciated functionality… I just  
end up with a black screen and no reason why.

---

<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 24, 2009, 9:38pm UTC](https://discourse.glfw.org/t/gl3-h/497/4 "2009-12-24T21:38:07Z")

</div>

**anonymous** wrote on [Thursday, December 24, 2009](https://sourceforge.net/p/glfw/discussion/247562/thread/46b29849/#59dc):

Well, still messing about with it. Figured that since I knew my code was 3.2+  
compliant from running on linux with gl3.h, I could just use plain ole glfw  
2.7 lite on windows and it should work just fine. I still got the same problem  
however, and it seems it’s because base opengl functions provided by windows  
can’t be accessed by glfwgetProcAddress. So, I’m going to exclude those from  
the windows compile. I’ll post back when I get it working. \>.\>

---

<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 25, 2009, 2:38pm UTC](https://discourse.glfw.org/t/gl3-h/497/5 "2009-12-25T14:38:43Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Friday, December 25, 2009](https://sourceforge.net/p/glfw/discussion/247562/thread/46b29849/#3e26):

Yeah, we should really support gl3.h and right now we don’t. I’m not sure if  
(the entire) GLFW 2.x can run the core profile, but if it can, it should be  
trivial to add a macro to select the GL header used.

I’m very interested in your work on this.

---

<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:** [January 2, 2010, 7:37am UTC](https://discourse.glfw.org/t/gl3-h/497/6 "2010-01-02T07:37:00Z")

</div>

**anonymous** wrote on [Saturday, January 02, 2010](https://sourceforge.net/p/glfw/discussion/247562/thread/46b29849/#633f):

Well, I was mainly showing my n00bness there.

Yes, for the most part, just adding a macro similar to the glu one works fine.  
Doing that, and excluding the examples and test from cmake was all that is  
needed for linux.

Under windows is another story ofcourse. Here, we also need to declare some  
function pointer variables, and set those. I wasn’t sure where the best place  
to put this all in glfw or I would have submitted a patch. These are the files  
I’m using in my current project to get full OpenGL 3.2 functionality on  
windows.

It would be nice if you could just define GLFW\_GL3, which would include gl3.h  
as it does in thise glfw.h, but would also provide the function pointers  
needed for windows, and add the init function right after context generation.  
(With a check to the opengl version for compliance I suppose.) However, I  
can’t see a way of doing this without polluting the glfw.h with our function  
pointer exports.

: [http://sites.google.com/site/scienthsine/glfw.h](http://sites.google.com/site/scienthsine/glfw.h)  
: [http://sites.google.com/site/scienthsine/gl3Init.c](http://sites.google.com/site/scienthsine/gl3Init.c)  
: [http://sites.google.com/site/scienthsine/gl3Init.h](http://sites.google.com/site/scienthsine/gl3Init.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:** [April 14, 2010, 10:31pm UTC](https://discourse.glfw.org/t/gl3-h/497/7 "2010-04-14T22:31:14Z")

</div>

**[pompei2](https://sourceforge.net/u/pompei2/)** wrote on [Wednesday, April 14, 2010](https://sourceforge.net/p/glfw/discussion/247562/thread/46b29849/#55c5):

Hi,

I see these changes are not in the trunk yet. Do you plan to integrate them  
some time soon? OpenGl 3 is the future, there is already 4 out here… Not many  
opensource libs support opengl3 yet, would be great if glfw was one of the  
first.

---

<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:** [April 20, 2010, 12:22pm UTC](https://discourse.glfw.org/t/gl3-h/497/8 "2010-04-20T12:22:04Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Tuesday, April 20, 2010](https://sourceforge.net/p/glfw/discussion/247562/thread/46b29849/#deff):

I’ve added a macro for including gl3.h to my tree, just working out a few  
details and I’ll commit it.
