Guides and reference manual

GLFW has comprehensive HTML documentation generated with Doxygen, containing both an API reference, guides for different parts of the API, a tutorial for beginners and a transition guide for users of GLFW 2.


GLFW is licensed under the zlib/libpng license, a simple license that permits modification, distribution and use in closed source software.


The GLFW FAQ answers many of the commonly asked questions about the design, inner workings and use of the library.

Example code

Below is a short example shows how the GLFW API looks and how easy it is to create and a window and OpenGL context with it. There are many more functions than those used here, but these are all you need to get started.

#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)
        return -1;

    /* Make the window's context current */

    /* Loop until the user closes the window */
    while (!glfwWindowShouldClose(window))
        /* Render here */

        /* Swap front and back buffers */

        /* Poll for and process events */

    return 0;