Reputation: 16884
What is an OpenGL Extension Library, Loading Library, Binding Library?
Why are they needed?
Can you explain in easy and plain layman's terms?
Upvotes: 6
Views: 1550
Reputation: 2260
The first thing to understand is that OpenGL is just the specification of a set on methods to interacts with your GPU. Then if you are on windows or linux, your GPU vendor will provide a driver that comes with an implementation of this specification. If you are on OSX, the implemetation is shipped with your OS.
To use OpenGL, you need an OpenGL context. It is essentially some memory that will hold the current state of OpenGL internal state machine. To create such context, you should use a binding library like glfw or freeglut.
Then you need to access the OpenGL methods. On Windows, you have opengl32.dll
library that gives access to legacy OpenGL1.1 only ! If you want to use modern OpenGL, you need to get the pointers to the functions exposed by the driver. There are several loading library for that. I think the most common one is glew.
OpenGL allows GPU vendors to provide custom extentions to the specification. You can retrieve these functions the same way you do for normal OpenGL functions. Once again, I would recommand to use glew which is also a extention library.
Then you need a header to have the prototypes for all these functions. But glew also handles that actually.
Upvotes: 8
Reputation: 162164
For every OpenGL support defined for a specific operating system only a very specific subset or version of OpenGL is being defined as a strict requirement. For Windows it is OpenGL-1.1, for Linux according to the LSB-4 it's OpenGL-1.2 (and according to LSB-5 it's OpenGL-2.1) and for MacOS-X every major release usually bumps it to the OpenGL version that was the state of the art, when the development of the specific version of OS-X started (which explains the lag between OpenGL version releases and its support in OS-X).
Apart from the very version that has been pinned down in the OS ABI specifications nothing is required to be available to programs. Which means, that a program running on Windows may not expect to see anything other than OpenGL-1.1 being supported. Or OpenGL-1.2 on Linux. Anything that goes beyond these versions is purely optional and the availability must be checked at runtime and all the function entry points required must be resolved dynamically at runtime.
OpenGL loaders do exactly that: They check, which OpenGL version profile is actually supported and load all the function that are actually available into symbols accessible by the programmer; of course one must not use those functions if after initialization it has been found, that they are not supported.
Upvotes: 2