Interface GLFunctionLoader


public interface GLFunctionLoader
Resolve the native address of an OpenGL function at runtime. The bindings generated by jextract only declare as static functions the OpenGL functions declared by the system headers. All other functions are declared by glext.h as function pointer typedefs, for which jextract generates PFN...PROC classes. A GL implementation invokes these functions through their PFN...PROC class, with the address given by the GLFunctionLoader of the platform (see AGL.load(String)).
Static versus dynamic loading of OpenGL functions
OS Static (bindings) Dynamic (function loader) Function loader
Windows OpenGL 1.0 and 1.1, the only versions exported by opengl32.dll OpenGL 1.2 to 4.6 and extensions wglGetProcAddress, falling back on the symbols of opengl32.dll. Requires a current GL context.
Linux OpenGL 1.0 to 1.3, and glBlendColor / glBlendEquation of 1.4 OpenGL 1.4 to 4.6 and extensions glXGetProcAddress
macOS OpenGL 1.0 to 2.1, framebuffer objects of 3.0, sync and base vertex functions of 3.2 Other functions of OpenGL 3.0 to 3.3 (e.g. vertex array objects, transform feedback, uniform buffers). They require a core profile context. Symbols of the OpenGL framework loaded by NativeLibLoader
The GL interface covers OpenGL 1.0 to 3.3. The Windows and Linux implementations also provide OpenGL 4.x functions, the macOS one does not. A function that can not be resolved, because the driver does not provide it or no context is current, makes the GL method throw an UnsupportedOperationException.
Author:
Martin Pernollet
See Also: