# How do I include all extensions my system supports using GLAD?

When using the GLAD web service, I am allowed to pick any version of OpenGL and any extensions I want.

If I pick the latest version of OpenGL and "all extensions", will the header file returned by the Web Service #define extensions on my machine that I do not actually have or does it just define those that exist?

In other words, if I include the GL_ARB_SHADER_CLOCK extension, on GLAD, does it get defined even if not available on the machine I use?

I don't see how it could be selectively defining extensions because the script is generated on a server ahead of time but I want to make sure that I am not trying to use unsupported extensions.

## 2 Answers

In this github issue the GLAD author offers the following way to correctly check if there is an extension is available at runtime:

The defines just allow you to check at compile time which extensions (and opengl versions) are potentially available. After loading/initilaizing glad you can check with GLAD_ if the extension is available at runtime (= supported by the driver and loaded).

// [initialize glad] // ...
if (!GLAD_GL_EXT_memory_object) {
die("GL_EXT_memory_object not supported!");
}

• You should accept your answer instead : )
– Ad N
Aug 29 '19 at 8:22

The "all" extensions option means exactly what it says: all extensions. If it exists, then its in the generated header. But this doesn't mean that the code will fail to execute on an implementation that doesn't provide every extension. The extensions you select are merely what the generated files make available to you.

But of course, the whole point of selecting specific extensions is that you don't have stuff you don't use cluttering up your header. If you're going to select everything, you may as well be using GLEW.

• So, the only reason not to include all extensions, is that you have a smaller header file generated from glad? Nov 9 '17 at 9:04
• @Startec: It's not just a smaller header. It means that you can't accidentally use extensions that you don't want to. It also means that you get better IntelliSense, since you're only going to see functions and enums that you want to be able to use. Nov 9 '17 at 14:25