zoukankan      html  css  js  c++  java
  • GLFW 环境如何配置?

    1.使用 https://glad.dav1d.de/ 生成 glad.h 头文件(用来动态加载Opengl函数指针)
    2.下载 https://www.glfw.org/ glfw 二进制库(GUI库)

    #define GLFW_INCLUDE_NONE
    #include "glad.h"
    #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);
    
    	// 使用 glad 加载 OPenGL 函数指针
    	if (!gladLoadGL()) {
    		return -1;
    	}
    
    	/* 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;
    }
    
    转载请注明出处并保持作品的完整性,谢谢
  • 相关阅读:
    .NET-记一次架构优化实战与方案-梳理篇
    .net core实践系列之SSO-跨域实现
    Vue
    C# WPF
    开源框架
    开源框架
    开源框架
    开源框架
    WCF
    WCF
  • 原文地址:https://www.cnblogs.com/cheungxiongwei/p/14481713.html
Copyright © 2011-2022 走看看