Includes OpenGL platform specific headers and defines several helpful
debugging macros. These macros are automatically disabled in release builds
but you can also disable their definition using
This exists so that CPM modules don't need to know about the method of context creation in order to properly use OpenGL. If you're on Windows, it is the responsibility of the context creator to ensure glew is correctly initialized and made current.
If you are looking for a simple way to create a platform independent OpenGL window with a context OpenGL context, I advise that you look into GLFW instead.
Simply include the following:
and OpenGL headers for your platform will be included in your project. On all systems but Windows, GLEW is not used and the system's OpenGL headers are imported. GLEW is used on Windows platforms where the system OpenGL headers have not been updated in a very long time.
cpm-gl-platform uses GLEW to provide better OpenGL support. You should
either issue the appropriate glewInit call yourself, or call
Be aware of the implications of using multiple rendering contexts with GLEW.
See http://glew.sourceforge.net/advanced.html for more information regarding
using thread-safe multiple rendering contexts with GLEW (in particular, the
To use the following variables, set them in your CMakeLists.txt before calling
CPM_AddModule for cpm-gl-platform.
GL_PLATFORM_NO_DEBUGGING- Disables the debug macros
- GLEW for Windows.