siniarskimar / zglgen

OpenGL bindings generator written in Zig
zlib License
2 stars 1 forks source link

Extension loaders should check if their extension is supported #28

Open siniarskimar opened 5 months ago

siniarskimar commented 5 months ago

Some extensions do not have any commands to load, mainly because they extend other commands or extend GLSL functionality. In that case the extension loader should check if an extension is supported by the current GL context.

siniarskimar commented 5 months ago

https://www.khronos.org/opengl/wiki/Load_OpenGL_Functions

glXGetProcAddress This function can operate without an OpenGL context, though the functions it returns obviously can't. This means that functions are not associated with a context in any way.

This also means that a non-NULL return value does not mean that the function is supported by any particular context. So it is more difficult to go "fishing" for entrypoints on GLX; use the standard OpenGL methods to query for available extensions.

In other words, it is necessary to check whenever an extension is supported before loading any of it's function pointers.