Why the OpenGL official wiki, suggest avoid manual load of OpenGL funcions?

Hi all,

I have a framework wich uses the OpenGL library, and this framework is used in differents projects.

I started using GLEW to load the OpenGL functions, but due to it forced including it before any OpenGL code, and that I had to set glewExperimental = true, which generates distrust in me, I decided to use SDL, but later I had to program in other application where SDL was not an option.

So I’m using “glXGetProcAddress” wich I think that is manual loading, and all works fine, but I am confused for this text in the OpenGL wiki:

You are strongly advised to use an OpenGL Loading instead of a manual process.

Thanks in adavance,
Alberto

What is confusing about the text in question? It’s advice.

Writing GL loading code is complicated and error-prone (and your version isn’t even cross-platform). Using an existing library has none of those disadvantages. That’s why the advice is there.

And there are libraries other than GLEW if you want a better OpenGL experience.

The word “strongly” made me think that could have other problems different of which you talk.

Note that this is just a wrapper around dlsym(); on Linux you can just define GL_GLEXT_PROTOTYPES before including <GL/gl.h> and use the functions directly. The loading process is a lot more involved on Windows.

Totally fine to load your own extension functions if you want to. If you don’t have that many functions, it’s pretty simple. Including the glext.h header function on the OpenGL Registry page makes declaring the function pointers very simple. And you’ll never be waiting for the next version of the library to come out to make use of some new extension.

But keep in mind that there are other extension loader besides GLEW (e.g. GLAD).

If only. … If you are writing a cross-platform application, it is far from simple. The getProcAddress function is part of the platform integration layer and each platform has its own and its own quirks. I think this is the main reason for the recommendation to use a loading library. Thankfully Vulkan made the getProcAddr APIs part of the Vulkan API so it is considerably more straightforward though much else is more complicated.