Creates a window and its associated context.
This function creates a window and its associated OpenGL or OpenGL ES
context. Most of the options controlling how the window and its context
should be created are specified with
Successful creation does not change which context is current. Before you
can use the newly created context, you need to
make it current. For information about the
The created window, framebuffer and context may differ from what you
requested, as not all parameters and hints are
hard constraints. This includes the size of the
window, especially for full screen windows. To query the actual attributes
of the created window, framebuffer and context, see @ref
To create a full screen window, you need to specify the monitor the window
will cover. If no monitor is specified, the window will be windowed mode.
Unless you have a way for the user to choose a specific monitor, it is
recommended that you pick the primary monitor. For more information on how
to query connected monitors, see
For full screen windows, the specified size becomes the resolution of the
window's desired video mode. As long as a full screen window is not
iconified, the supported video mode most closely matching the desired video
mode is set for the specified monitor. For more information about full
screen windows, including the creation of so called windowed full screen
or borderless full screen windows, see
Once you have created the window, you can switch it between windowed and
full screen mode with
glfwSetWindowMonitor. This will not
OpenGL or OpenGL ES context.
By default, newly created windows use the placement recommended by the
window system. To create the window at a specific position, make it
initially invisible using the
hint, set its
) and then [show
As long as at least one full screen window is not iconified, the screensaver is prohibited from starting.
Window systems put limits on window sizes. Very large or very small window
dimensions may be overridden by the window system on creation. Check the
size after creation.
swap interval is not set during window creation and
the initial value may vary depending on driver settings and defaults.
$widthThe desired width, in screen coordinates, of the window. This must be greater than zero.
$heightThe desired height, in screen coordinates, of the window. This must be greater than zero.
$titleThe initial, UTF-8 encoded window title.
$monitorThe monitor to use for full screen mode, or
NULLfor windowed mode.
$shareThe window whose context to share resources with, or
NULLto not share resources.