Why does one need to wrangle extensions for the opengl functions?
Hi. Beginner here. I do not understand why one has to wrangle extensions for opengl functions like glDisable etc... on windows and linux platforms (I think mac is an exception). If you are building a hello world application you would first create the OpenGL context, create the window, and then wrangle the extensions using GLEW or manually. But why do you have to "wrangle" these extensions? Are there not bindings for the gl functions in the header files that come with the Visual Studio and linux development environments? Do not those gl functions have definitions in the device drivers that are installed in the OS for a particular gpu?
On Windows, opengl32.dll only exports the functions which are part of the OpenGL 1.1 API. For anything else, you need to use wglGetProcAddress() (or a higher-level library such as GLEW).
On Linux, libGL.so is updated regularly with new functions, but the driver (for direct rendering) or the X server (for indirect rendering) may support additional functions beyond those exported by the library.
In either case, the library is just a conduit between the application and the driver (or the X server). The application may be able to use newer functions, but still work without them. If it referenced the function directly, it would fail to work (or even load) if the OpenGL library was out of date, even if the driver supported the function or if the application could work without it.
By querying the function at run-time, this issue is avoided.
Also, some functions may only be available in certain contexts. E.g. on a system with multiple video cards, each card may support a different set of functions (particularly extensions, which are often vendor-specific). And a single card may support different functions depending upon whether you're using a compatibility profile or core profile context.