GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan application development. It provides a simple, platform-independent API for creating windows, contexts and surfaces, reading input, handling events, etc.
GLFW natively supports Windows, macOS and Linux and other Unix-like systems. An experimental implementation for the Wayland protocol is available but not yet officially supported.
GLFW is licensed under the zlib/libpng license.
The latest stable release is version 3.2.1.
See the downloads page for details and files, or fetch the
latest branch, which always points to the latest stable release. Each release starting with 3.0 also has a corresponding annotated tag with source and binary archives. The version history lists all user-visible changes for every release.
This is a development branch for version 3.3, which is not yet described. Pre-release documentation is available here.
master branch is the stable integration branch and should always compile and run on all supported platforms, although details of newly added features may change until they have been included in a release. New features and many bug fixes live in other branches until they are stable enough to merge.
If you are new to GLFW, you may find the tutorial for GLFW 3 useful. If you have used GLFW 2 in the past, there is a transition guide for moving to the GLFW 3 API.
GLFW itself requires only the headers and libraries for your window system. It does not need the headers for any context creation API (WGL, GLX, EGL, NSGL, OSMesa) or rendering API (OpenGL, OpenGL ES, Vulkan) to enable support for them.
GLFW supports compilation on Windows with Visual C++ 2010 and later, MinGW and MinGW-w64, on macOS with Clang and on Linux and other Unix-like systems with GCC and Clang. It will likely compile in other environments as well, but this is not regularly tested.
There are pre-compiled Windows binaries available for all supported compilers.
See the compilation guide for more information about how to compile GLFW yourself.
See the documentation for tutorials, guides and the API reference.
See the contribution guide for more information.
GLFW supports Windows XP and later and macOS 10.7 and later. Linux and other Unix-like systems running the X Window System are supported even without a desktop environment or modern extensions, although some features require a running window or clipboard manager. The OSMesa backend requires Mesa 6.3.
See the compatibility guide in the documentation for more information.
GLFW itself depends only on the headers and libraries for your window system.
The (experimental) Wayland backend also depends on the
extra-cmake-modules package, which is used to generated Wayland protocol headers.
The examples and test programs depend on a number of tiny libraries. These are located in the
The Vulkan example additionally requires the LunarG Vulkan SDK to be installed, or it will not be included in the build. On macOS you need to provide the path to the SDK manually as it has no standard installation location.
The documentation is generated with Doxygen if CMake can find that tool.
Bugs are reported to our issue tracker. Please check the contribution guide for information on what to include when reporting a bug.
glfwGetErrorfunction for querying the last error code and its description (#970)
glfwUpdateGamepadMappingsfunction for importing gamepad mappings in SDL_GameControllerDB format (#900)
glfwJoystickIsGamepadfunction for querying whether a joystick has a gamepad mapping (#900)
glfwGetJoystickGUIDfunction for querying the SDL compatible GUID of a joystick (#900)
glfwGetGamepadNamefunction for querying the name provided by the gamepad mapping (#900)
GLFWgamepadstatefor retrieving gamepad input state (#900)
glfwSetWindowContentScaleCallbackfor DPI-aware rendering (#235,#439,#677,#845,#898)
glfwRequestWindowAttentionfunction for requesting attention from the user (#732,#988)
glfwGetKeyScancodefunction that allows retrieving platform dependent scancodes for keys (#830)
GLFWwindowmaximizefunfor receiving window maximization events (#778)
glfwSetWindowAttribfunction for changing window attributes (#537)
glfwGetJoystickHatsfunction for querying joystick hats (#889,#906,#934)
glfwInitHintfor setting initialization hints
glfwWindowHintStringfor setting string type window hints (#893,#1139)
glfwSetWindowOpacityfor controlling whole window transparency (#1089)
glfwGetMonitorUserPointerfor per-monitor user pointers
glfwGetJoystickUserPointerfor per-joystick user pointers
glfwSetX11SelectionStringfunctions for accessing X11 primary selection (#894,#1056)
GLAPIENTRYto public header
GLFW_TRANSPARENT_FRAMEBUFFERwindow hint and attribute for controlling per-pixel framebuffer transparency (#197,#663,#715,#723,#1078)
GLFW_HOVEREDwindow attribute for polling cursor hover state (#1166)
GLFW_CENTER_CURSORwindow hint for controlling cursor centering (#749,#842)
GLFW_FOCUS_ON_SHOWwindow hint and attribute to control input focus on calling show window (#1189)
GLFW_SCALE_TO_MONITORwindow hint for automatic window resizing (#676,#1115)
GLFW_JOYSTICK_HAT_BUTTONSinit hint (#889)
GLFW_LOCK_KEY_MODSinput mode and
GLFW_MOD_*_LOCKmod bits (#946)
GLFW_COCOA_FRAME_NAMEwindow hint (#195)
GLFW_COCOA_GRAPHICS_SWITCHINGwindow hint (#377,#935)
GLFW_X11_INSTANCE_NAMEwindow hints (#893,#1139)
GLFW_INCLUDE_ES32for including the OpenGL ES 3.2 header
GLFW_OSMESA_CONTEXT_APIfor creating OpenGL contexts with OSMesa (#281)
GenerateMappings.cmakescript for updating gamepad mappings
glfwCreateWindowSurfaceemit an error when the window has a context (#1194,#1205)
glfwMaximizeWindowon a full screen window was not ignored
GLFW_INCLUDE_VULKANcould not be combined with the corresponding OpenGL and OpenGL ES header macros
WM_INPUTfor disabled cursor mode motion input (#125)
FindVulkan.cmakewas VS specific (#928)
glfwVulkanSupportedemitted an error on systems with a loader but no ICD (#916)
glfw3native.hwould undefine a foreign
glfwCreateWindowactivated window even with
GLFW_FOCUSEDhint set to false (#1179,#1180)
XI_RawMotionfor disable cursor mode motion input (#125)
_GLFW_HAS_XF86VMcompile-time option with dynamic loading
glfwGetVideoModewould segfault on Cygwin/X
SYN_DROPPEDin pre-2.6.39 kernel headers (#1196)
glfwInitwould fail if inotify creation failed (#833)
strdupwas used without any required feature macro (#1055)
CGDisplayModeCopyPixelEncodingfunction on macOS 10.12+
glfwSetWindowMonitorwould set incorrect position and size (#748)
WGL_EXT_colorspacefor OpenGL ES contexts
On glfw.org you can find the latest version of GLFW, as well as news, documentation and other information about the project.
If you have questions related to the use of GLFW, we have a forum, and the
#glfw IRC channel on Freenode.
If you have a bug to report, a patch to submit or a feature you'd like to request, please file it in the issue tracker on GitHub.
Finally, if you're interested in helping out with the development of GLFW or porting it to your favorite platform, join us on the forum, GitHub or IRC.
GLFW exists because people around the world donated their time and lent their skills.