Build an OpenGL development environment

material

Installation Tutorial

software download

  1. Visual Studio 2019
  2. CMake
  3. GLFW
  4. GLAD

glfw 3.3.8

The purpose of downloading glfw:

  1. Get the include in the compressed package
  2. Generate glfw3.lib

get include

Unzip and find Include, include contains the GLFW folder
insert image description here

Generate glfw3.lib

  1. Use CMake to generate GLFW project files
  2. Find the file with the suffix sln in the generated directory, double-click to open it
  3. Select x64, right click on the solution, generate a solution
  4. There are generated files in the generated directory src/Debug, glfw3.lib

glad 3.3

  1. Download and unzip to get folders: src、 Include
  2. scr contains the glad.c file
    insert image description here
  3. Include folder contains glad and KHR folders

folder organization

Create a new folder with the following structure

  1. Link/Include stores glad, KHR, GLFW
  2. Link/Lib store glfw3.lib
  3. Link/src stores glad.c

IDE link file

  1. Use to create a new C++ empty project, set it to x64, select project/properties
  2. Add the include directory to the VC++ directory, and the path where Link/Include is located
  3. Add the library directory to the VC++ directory, the path where Link/Lib is located
  4. linker/input/additional dependencies add opengl32.lib and glfw3.lib
  5. Select Project/Add/Existing Item Add Glad.c in Link/scr

test

  1. Create a new file cpp file
  2. Copy the code to the cpp file and test the code
  3. A window appears when running, indicating that the configuration is successful, as shown in the figure below
    insert image description here

Guess you like

Origin blog.csdn.net/weixin_43796392/article/details/131425650