Why are extensions available as function pointers?

Im new and Im interested to know why are the opengl extensions available as function pointer and not as some c style API or as some exported class?

Well, function pointers are a “c style API”. I don’t really understand what you’re trying to say there. And they don’t use an “exported class” because OpenGL is a C API. An “exported class” would by definition not be C.

Because the availability of the extensions depends on the combination of the driver version and GPU capabilities.

They have to be discovered dynamically (ie at runtime) by any program that wants to use them. If an extension is advertised by the driver (ie if the extension exists in the string returned by glGetString(GL_EXTENSIONS) ), then the functions defined by this specific extension exists and you can retrieve their pointers by a call to a wgl-specific or glx-specific or mac-specific flavor of getprocaddress() (which the glew lib can hide for you).

Thanks Overlay, now I understand.

Alfonse, Thanks for the reply. I wanted to understand why these extensions are available as function pointers and not as some functions/classes which can be in a Dll or something.



thanks, I now realize what I asked and what you wrote in the post.

thanks again.