15
\$\begingroup\$

I am looking for a beginner-friendly explanation. The official website's explanation is too short and lead me to more questions than answers:


  • What is GLEW?

GLEW developer's page says:

The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library. GLEW provides efficient run-time mechanisms for determining which OpenGL extensions are supported on the target platform.


  • But what is an extension loading library?

OpenGL's wiki says

An OpenGL Loading Library is a library that loads pointers to OpenGL functions at runtime, core as well as extensions.


  • What does it mean to load pointers to OpenGL functions?

  • What is an extension?

  • What does it mean by "core as well as extensions"?

\$\endgroup\$
20
\$\begingroup\$

Most compilers give you an OpenGL header that provides support for OpenGL 1.1, but most of the functions provided in that version of OpenGL have been long since deprecated, and lacks important features such as shaders and vertex buffer objects. GLEW is basically just a header (there is a source file that must also be compiled, but you can just include it in your project) that provides newer OpenGL functionality.

What does it mean by extension?

Here's a link from OpenGL.org about them. They're just additional functions for OpenGL that aren't part of OpenGL. They provide functionality which may be useful, but you cannot guarantee that they're going to work on every computer since they are not part of core OpenGL.

What does it mean to load pointers to OpenGL functions?

OpenGL is implemented by the graphics driver as a bunch of functions implemented according to the spec, not as a standalone library, therefore cannot be simply linked to your project.

You have to call a function (such as GetProcAddress, but it depends on the platform you're developing for) to get the function pointer at runtime from the driver for each OpenGL function.

GLEW exists because doing just that can be very difficult. It's much easier when you can just include a header and call one function during initialization, which is exactly what GLEW does. Plus, GLEW is cross-platform.

What does it mean by "core as well as extensions"?

It means it supplies OpenGL functions as well as OpenGL extensions.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .