Functional header design
The OpenGL API is iteratively developed and released in versions internally (for the API specification) named functions. The latest Function / Version of OpenGL is 4.5. Previous version 1.0, 1.1, 1,2, 1,3, 1,4, 1,5, 2,0, 2,1, 3,0, 3,1, 3,2, 3,3, 4,0, 4.1, 4.2, 4.3 and 4.4. OpenGL uses the deprecation model to remove obsolete parts of its API, which results in compatibility (with the deprecated API) and (without the use of deprecated APIs) that manifest in the target OpenGL Context. In addition, new API concepts are proposed as extensions (often vendor-specific) that can be integrated into future versions. All this leads to manifestations of the OpenGL API that you can use in your program.
One difficult task is to stick to one consistent set of functions in your own OpenGL (for example, OpenGL 3.2 Core, if you want to develop for every Windows, macOS and Linux released in the last 4 years). glbinding facilitates this by providing the headers of each function with well-defined / generated subsets of the OpenGL API.
All OpenGL Headers
If you do not use headers for each function, the OpenGL program might look like this: this:
#include <glbinding/gl/gl.h> // draw code gl::glClear(gl::GL_COLOR_BUFFER_BIT | gl::GL_DEPTH_BUFFER_BIT); gl::glUniform1i(u_numcubes, m_numcubes); gl::glDrawElementsInstanced(gl::GL_TRIANGLES, 18, gl::GL_UNSIGNED_BYTE, 0, m_numcubes * m_numcubes);
OpenGL Headers with One Functionality
When developing code on Windows with the latest drivers installed, the above code will most likely compile and run. But if you want a port that is a system with less mature driver support (for example, macOS or Linux using open source drivers), you may wonder if glDrawElementsInstanced is available. In this case, just switch to the headers for each glbinding function and select the OpenGL 3.2 Core headers (as you know, at least this version is available on all target platforms):
#include <glbinding/gl32core/gl.h> // draw code gl32core::glClear(gl32core::GL_COLOR_BUFFER_BIT | gl32core::GL_DEPTH_BUFFER_BIT); gl32core::glUniform1i(u_numcubes, m_numcubes); gl32core::glDrawElementsInstanced(gl32core::GL_TRIANGLES, 18, gl32core::GL_UNSIGNED_BYTE, 0, m_numcubes * m_numcubes);
If the code compiles, you can be sure that it is OpenGL 3.2 Core compatible. Using features that are not yet available or the deprecated feature is prohibited.