美文网首页
windows 下最简单的glfw 工程

windows 下最简单的glfw 工程

作者: lbfamous | 来源:发表于2020-09-09 01:18 被阅读0次
    #include <GLFW/glfw3.h>
    
    #ifdef _WIN32
        #pragma comment(lib,"opengl32.lib")
        #pragma comment(lib,"glfw3.lib")
    #endif // 
    
    const int WIDTH = 640;
    const int HEIGHT = 480;
    
    
    int main(int argc, char** argv){
    
        glfwInit();
    
        GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "OGL_APP1", NULL, NULL);
        if (window == nullptr){
            glfwTerminate();
            return -1;
        }
    
        glfwMakeContextCurrent(window);
    
        while (!glfwWindowShouldClose(window)){
    
            glClearColor(0, 0, 1.0, 0.0);
            glClear(GL_COLOR_BUFFER_BIT);
    
            glfwSwapBuffers(window);
            glfwPollEvents();
        }
        return 0;
    }
    

    相关文章

      网友评论

          本文标题:windows 下最简单的glfw 工程

          本文链接:https://www.haomeiwen.com/subject/oxpsektx.html