Here is a single header file one need to include to get hands on ALL OpenGL functionality from the very first version and up to the current:
The great simplification this header brings with it is an automatic function pointer initialization. User does not need to bother to initialize the function pointers manually. All known core function version pointers are declared in the LoadGL.h and each of them points to the corresponding loading function at program initialization. First time the function is called, it's loader automatically searches for an entry point, mangles the pointer so that it points to that address, then calls it with the given arguments. After that the pointer points directly to the OpenGL function (if present; otherwise call has no effect). Simple magic.
Be aware though, that the rendering context which has been set current when the function was called first time must be active all subsequent function call times, so it is not allowed to use the pointers with the rendering context different from what was bound first time the function was called.
So all you need to do in order to use any of the OpenGL function you have seen in the reference pages, is to place the LoadGL.h file into the directory with your project and include it:
After that you can call any of the OpenGL functions (make sure the rendering context created, though). As simple as that. Of course, it is always a good practice to check if the given extension is available, but if it isn't, call to unsupported function will be just ignored.
It is a time consuming work to update the header with each new version of OpenGL being published, but the header served me well for years, so I keep it updated and feel like sharing right now. So feel free to use it and let me know if there is anything more you would like to see in it.
Last edited by Yandersen; 07-04-2014 at 07:49 AM.
Tags for this Thread