I’ve been reading on the gl.h header file included with my version of Visual Studio and it seems heavily outdated.
I do not want GLUT or any other middleware/utility library in between to do the dirty work for me, that includes GLEW. Could someone elaborate on why and how does one acquire/query for the modern feature set of the 4.0 specification and what’s the idea behind GLEW in general?
The gl.h shipping with MSVC++ covers only the functions exported by the opengl32.dll shipping with Windows. This DLL is mostly only a so called “trampoline” into the actual driver. But it only exports a very old version of OpenGL, namely OpenGL-1.1.
Any functionality beyond that must be accessed through the extension mechanism.
GLUT is completely unrelated to GLEW
You aquire the modern feature set through the already mentioned extension system.
There is a function
?glGetProcAddress(exact name depending on the OS environment, in WindowswglGetProcAddress). Using this function you retrieve function pointers to the procedures of extensions for the current OpenGL context (in GLX the function pointers are the same for all contexts, but in Windows they may differ).Loading a extension goes about this:
And you have to write the bulk code of this for each and every function. Nobody wants to write this. So the developers of GLEW came up with a set of scripts, that fetch the extension specifications from opengl.org and automatically create the whole extension loading and wrap this into a small library, that creates no additional dependencies.
If you want to use higher OpenGL functionality: Use GLEW. Not because it’s mandatory, but because it’s the most straightforward way to go about this.