glfw example window

Solutions on MaxInterview for glfw example window by the best coders in the world

showing results for - "glfw example window"
Elio
29 Nov 2019
1#include <GLFW/glfw3.h>
2
3int main(void)
4{
5    GLFWwindow* window;
6
7    /* Initialize the library */
8    if (!glfwInit())
9        return -1;
10
11    /* Create a windowed mode window and its OpenGL context */
12    window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
13    if (!window)
14    {
15        glfwTerminate();
16        return -1;
17    }
18
19    /* Make the window's context current */
20    glfwMakeContextCurrent(window);
21
22    /* Loop until the user closes the window */
23    while (!glfwWindowShouldClose(window))
24    {
25        /* Render here */
26        glClear(GL_COLOR_BUFFER_BIT);
27
28        /* Swap front and back buffers */
29        glfwSwapBuffers(window);
30
31        /* Poll for and process events */
32        glfwPollEvents();
33    }
34
35    glfwTerminate();
36    return 0;
37}