Introduce how to set up the environment of OpenGL in macOS.
Refer to https://blog.csdn.net/sinat_14891561/article/details/74941333
Basic Env:
- Platform: macOS High Sierra
- Xcode: 9.4.1
- OpenGL: 4.1
Suggestion
Even though we can compile and install GLFW&GLEW manually, I still strongly recommend installation by home-brew, especially for those who have already installed brew.
Issue
Header Search Paths as well as Library Search Paths in Search Paths (Buildings) should be declared specifically. /usr/local/include/**
may cause ERRORs like #include nested too deeply
, because other libraries might exist in this folder.
The solution is to use usr/local/include/glad
instead. However, another ERROR will be caused in glad.c, indicating that <glad/glad.h> cannot be found. Modify it into <glad.h>. <KHR/khrplatform.h>, <GL/glew.h> and <GLFW/glfw.h> are also the same.