Reminder Post: How to Generate WGL Extension Files with glLoadGen

I always seem to forget how to do this, so I'm writing myself a reminder post of how to do this just so that I can refer to it and hopefully people can find it and do it for themselves.

If you don't know what glLoadGen is, glLoadGen is a more modern way to load OpenGL and related functions. The main difference with GLEW is that it creates only the definitions and declarations of the functions that are found within the spec and version you want. That is to say, if you only want the functions which work and are included in OpenGL 3.3 Core Profile, you only receive those, none of the deprecated or newer functions.

In general I have found this to be cleaner and easier to set up in Windows for my OpenGL applications. It's true that if you want fall-backs (as in, another version of OpenGL assuming the card you are running on doesn't support it), you would still want to use something like GLEW, but I have not found that to be the case yet.

glLoadGen includes files for non-core extensions that can build you source files that do the same thing. This includes WGL (Windows GL) which is necessary to setup an OpenGL context using Win32.

glLoadGen uses LUA, so you need at least LUA 5.1.

To generate the WGL extension source files:

*FileNameSuffix* can be changed for whatever you want the suffix of your files to be. You can also change the -style flag to whatever you prefer, pointer_c, pointer_cpp, func_cpp, etc.

In the same directory which you ran the LUA script you should find two files (the extensions could be hpp and cpp for other styles):


Include these in your project, and you should be able to use WGL functions.