OpenGL GLFW库配置
1.GLFW
下载:https://sourceforge.net/projects/glfw/
官网 :https://www.glfw.org/download.html (可能登录不了)
下载后解压 glfw-3.3.8.bin.WIN32.zip
将include 和 lib-vc2019 配置到VS的工程内
需要的lib:
openGL32.lib --- 不要忘了
glfw3.lib
测试代码:
#include <GLFW/glfw3.h>
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
ps: https://learnopengl.com/
浙公网安备 33010602011771号