Environment: QT5.8.0, VS2015
1, download GLFW source code; Address:https://www.glfw.org/download.html
2, download the CMAKE tool; Address:http://www.cmake.org/cmake/resources/software.html
3. Start the CMAKE-GUI to configure the source code and compile path; as shown in the figure:
4, click Configure to select VS 2015 as shown in the figure:
5. Check the build_shaRd_libs, this step must be checked! Otherwise, it will cause the library to be unavailable! As shown in the figure:
6. Click the Generate to generate item and use VS2015 to open the project to generate in the Build directory.
7. Copy the generated library files to the project of the project and import the project. DLL files are placed in the project execution file directory, copy the header file in Include to the project’s header file directory and import. The position is as follows:
9. Download freeglut source code, address: https://sourceForge.net/projects/freeglut/
Note: If you cannot download it, you can search the freeglut source code to download
10. Use CMAKE to compile, the steps are the same as compiling GLFW.
11. Copy the corresponding LIB, DLL, Include files to the project. The position is as follows:
10. Configure the GLAD library, select the corresponding OpenGL version, VS version, PROFILE select Core, and check the general to loader. Address:https://glad.dav1d.de/
11. Add GLAD library to the project.
12. The test is successful, and the configuration is successful without reporting. There will be no window display. code show as below:
#include <glad/glad.h>
#include <GLFW/glfw3.h>
int main()
{
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
//glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
return 0;
}
Note: It is best to add directly to the installation directory of VS, that is,: C: \ Program Files (X86) \ Microsoft Visual Studio 14.0 \ VC \ Include
as shown in the figure:
Reference URL:https://learnopengl-cn.github.io/01%20Getting%20started/02%20Creating%20a%20window/