当前位置:网站首页>Part 1: building OpenGL environment

Part 1: building OpenGL environment

2022-06-24 07:57:00 Code Knight

Catalog

One 、GLFW

1、 What is? GLFW

2、 structure GLFW

(1) download GLFW Source package

(2) decompression

Two 、CMake

1、 What is? CMake

 2、 install

(1) download CMake Compiler tools

(2) install CMake

(3) open GUI Interface

(4) Select the local vs Version Click finish:

(5) Click again on the configure

(6) Next click generate:

3、 compile

(1) stay build You can see in the folder GLFW.sln file :

(2) Use vs2019 open GLFW.sln file , Click generate solution

4、 link  

(1) Can be in src\Debug There is... In the folder glfw3.lib file

(2) Create a new folder ( Random names ) Then create two subfolders Includes and Libs

(3) find GLFW Folder

(4) take GLFW File put in Includes Folder

(5) take glfw3.lib File put in Libs Folder

(6) open vs Create a VC++ Empty item

(7) Modify properties

(8) Include directory add :D:\OpenGL_Link\Includes; Library Directory add :D:\OpenGL_Link\Libs;

(9) Input options in the linker , add to glfw3.lib and opengl32.lib(glfw3.lib That's the front. Libs In a folder ,opengl32.lib stay windows The following is the installation VS I brought it with me ): Click OK after configuration .

3、 ... and 、GLAD

1、 What is? GLAD

2、 Online configuration  

3、 download glad Compressed package

4、 decompression

5、 Project configuration

Four 、 Output window

1、 Create a new one main.cpp

2、 Enter the code

3、 Compile operation


One 、GLFW

1、 What is? GLFW

 

2、 structure GLFW

(1) download GLFW Source package

Download | GLFW

(2) decompression

Two 、CMake

1、 What is? CMake

 2、 install

(1) download CMake Compiler tools

Download | CMake

(2) install CMake

Check add environment variable

(3) open GUI Interface

Set the first two paths and click configure:

(4) Select the local vs Version Click finish:

(5) Click again on the configure

(6) Next click generate:

3、 compile

(1) stay build You can see in the folder GLFW.sln file :

(2) Use vs2019 open GLFW.sln file , Click generate solution

4、 link  

(1) Can be in src\Debug There is... In the folder glfw3.lib file

(2) Create a new folder ( Random names ) Then create two subfolders Includes and Libs

(3) find GLFW Folder

(4) take GLFW File put in Includes Folder

(5) take glfw3.lib File put in Libs Folder

(6) open vs Create a VC++ Empty item

(7) Modify properties

(8) Include directory add :D:\OpenGL_Link\Includes; Library Directory add :D:\OpenGL_Link\Libs;

(9) Input options in the linker , add to glfw3.lib and opengl32.lib(glfw3.lib That's the front. Libs In a folder ,opengl32.lib stay windows The following is the installation VS I brought it with me ): Click OK after configuration .

3、 ... and 、GLAD

1、 What is? GLAD

2、 Online configuration  

https://glad.dav1d.de

Online configuration , And then click GENERATE, The following page pops up , download glad.zip:

3、 download glad Compressed package

4、 decompression

5、 Project configuration

find glad Medium glad and KHR Folder

Put it in GLFW In the same directory

And then copy it src\glad.c file

Add to the project you just created

Four 、 Output window

1、 Create a new one main.cpp

2、 Enter the code :

#include <glad/glad.h> 
#include <GLFW/glfw3.h>

#include <iostream>

int main() {

	std::cout << "hello world!" << std::endl;

	return 0;
}

3、 Compile operation :

--END--

原网站

版权声明
本文为[Code Knight]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206240351284159.html