I want to use OpenGL but I don't know how to set up GLEW. Would I lose something if I am going to use Glad? Could I learn from tutorials that use GLEW?
If you're starting programming with OpenGL on a desktop platform then either one will work and the choice isn't that critical. Switching later is also still an option. The choice only becomes more important, and more objective, for advanced use cases.
Glad is typically used by selecting the necessary extensions in the web interface, downloading the generated source and header files and copying them into your project. GLEW is a library that needs to be installed and is usually added as an dependency in, e.g., CMake.
Advantages of Glad:
- Being able to select only the extensions you use, leading to (slightly) faster compile times and initialization at runtime.
- No additional dependency for your project.
- Also supports the APIs OpenGL ES, EGL, GLX, and WGL.
- Also supports the languages D, Volt, Nim and Pascal.
Advantages of GLEW:
- Adding GLEW as a dependency to, e.g., your CMakeLists.txt is enough to make it work.
- No large additional header and source files in your repository.
- GLEW can detect which extensions are available at runtime.
This allows your program to adapt to the available extensions. For example, it can select a fallback path if a certain extension is not available on older hardware.
Other OpenGL loading libraries exists as well. See here: https://www.khronos.org/opengl/wiki/OpenGL_Loading_Library
Disclaimer: The answer is based on my own (limited) experience with both libraries and reading the experiences of others.
© 2022 - 2024 — McMap. All rights reserved.