raygui-widget
Classes | Macros | Typedefs | Functions
Window reference

Functions and types related to windows. More...

Classes

struct  GLFWimage
 Image data. More...
 

Macros

#define GLFW_FOCUSED   0x00020001
 Input focus window hint and attribute. More...
 
#define GLFW_ICONIFIED   0x00020002
 Window iconification window attribute. More...
 
#define GLFW_RESIZABLE   0x00020003
 Window resize-ability window hint and attribute. More...
 
#define GLFW_VISIBLE   0x00020004
 Window visibility window hint and attribute. More...
 
#define GLFW_DECORATED   0x00020005
 Window decoration window hint and attribute. More...
 
#define GLFW_AUTO_ICONIFY   0x00020006
 Window auto-iconification window hint and attribute. More...
 
#define GLFW_FLOATING   0x00020007
 Window decoration window hint and attribute. More...
 
#define GLFW_MAXIMIZED   0x00020008
 Window maximization window hint and attribute. More...
 
#define GLFW_CENTER_CURSOR   0x00020009
 Cursor centering window hint. More...
 
#define GLFW_TRANSPARENT_FRAMEBUFFER   0x0002000A
 Window framebuffer transparency hint and attribute. More...
 
#define GLFW_HOVERED   0x0002000B
 Mouse cursor hover window attribute. More...
 
#define GLFW_FOCUS_ON_SHOW   0x0002000C
 Input focus on calling show window hint and attribute. More...
 
#define GLFW_RED_BITS   0x00021001
 Framebuffer bit depth hint. More...
 
#define GLFW_GREEN_BITS   0x00021002
 Framebuffer bit depth hint. More...
 
#define GLFW_BLUE_BITS   0x00021003
 Framebuffer bit depth hint. More...
 
#define GLFW_ALPHA_BITS   0x00021004
 Framebuffer bit depth hint. More...
 
#define GLFW_DEPTH_BITS   0x00021005
 Framebuffer bit depth hint. More...
 
#define GLFW_STENCIL_BITS   0x00021006
 Framebuffer bit depth hint. More...
 
#define GLFW_ACCUM_RED_BITS   0x00021007
 Framebuffer bit depth hint. More...
 
#define GLFW_ACCUM_GREEN_BITS   0x00021008
 Framebuffer bit depth hint. More...
 
#define GLFW_ACCUM_BLUE_BITS   0x00021009
 Framebuffer bit depth hint. More...
 
#define GLFW_ACCUM_ALPHA_BITS   0x0002100A
 Framebuffer bit depth hint. More...
 
#define GLFW_AUX_BUFFERS   0x0002100B
 Framebuffer auxiliary buffer hint. More...
 
#define GLFW_STEREO   0x0002100C
 OpenGL stereoscopic rendering hint. More...
 
#define GLFW_SAMPLES   0x0002100D
 Framebuffer MSAA samples hint. More...
 
#define GLFW_SRGB_CAPABLE   0x0002100E
 Framebuffer sRGB hint. More...
 
#define GLFW_REFRESH_RATE   0x0002100F
 Monitor refresh rate hint. More...
 
#define GLFW_DOUBLEBUFFER   0x00021010
 Framebuffer double buffering hint. More...
 
#define GLFW_CLIENT_API   0x00022001
 Context client API hint and attribute. More...
 
#define GLFW_CONTEXT_VERSION_MAJOR   0x00022002
 Context client API major version hint and attribute. More...
 
#define GLFW_CONTEXT_VERSION_MINOR   0x00022003
 Context client API minor version hint and attribute. More...
 
#define GLFW_CONTEXT_REVISION   0x00022004
 Context client API revision number attribute. More...
 
#define GLFW_CONTEXT_ROBUSTNESS   0x00022005
 Context robustness hint and attribute. More...
 
#define GLFW_OPENGL_FORWARD_COMPAT   0x00022006
 OpenGL forward-compatibility hint and attribute. More...
 
#define GLFW_OPENGL_DEBUG_CONTEXT   0x00022007
 Debug mode context hint and attribute. More...
 
#define GLFW_OPENGL_PROFILE   0x00022008
 OpenGL profile hint and attribute. More...
 
#define GLFW_CONTEXT_RELEASE_BEHAVIOR   0x00022009
 Context flush-on-release hint and attribute. More...
 
#define GLFW_CONTEXT_NO_ERROR   0x0002200A
 Context error suppression hint and attribute. More...
 
#define GLFW_CONTEXT_CREATION_API   0x0002200B
 Context creation API hint and attribute. More...
 
#define GLFW_SCALE_TO_MONITOR   0x0002200C
 Window content area scaling window window hint.
 
#define GLFW_COCOA_RETINA_FRAMEBUFFER   0x00023001
 macOS specific window hint.
 
#define GLFW_COCOA_FRAME_NAME   0x00023002
 macOS specific window hint.
 
#define GLFW_COCOA_GRAPHICS_SWITCHING   0x00023003
 macOS specific window hint.
 
#define GLFW_X11_CLASS_NAME   0x00024001
 X11 specific window hint.
 
#define GLFW_X11_INSTANCE_NAME   0x00024002
 X11 specific window hint.
 
#define GLFW_FOCUSED   0x00020001
 Input focus window hint and attribute. More...
 
#define GLFW_ICONIFIED   0x00020002
 Window iconification window attribute. More...
 
#define GLFW_RESIZABLE   0x00020003
 Window resize-ability window hint and attribute. More...
 
#define GLFW_VISIBLE   0x00020004
 Window visibility window hint and attribute. More...
 
#define GLFW_DECORATED   0x00020005
 Window decoration window hint and attribute. More...
 
#define GLFW_AUTO_ICONIFY   0x00020006
 Window auto-iconification window hint and attribute. More...
 
#define GLFW_FLOATING   0x00020007
 Window decoration window hint and attribute. More...
 
#define GLFW_MAXIMIZED   0x00020008
 Window maximization window hint and attribute. More...
 
#define GLFW_CENTER_CURSOR   0x00020009
 Cursor centering window hint. More...
 
#define GLFW_TRANSPARENT_FRAMEBUFFER   0x0002000A
 Window framebuffer transparency hint and attribute. More...
 
#define GLFW_HOVERED   0x0002000B
 Mouse cursor hover window attribute. More...
 
#define GLFW_FOCUS_ON_SHOW   0x0002000C
 Input focus on calling show window hint and attribute. More...
 
#define GLFW_MOUSE_PASSTHROUGH   0x0002000D
 Mouse input transparency window hint and attribute. More...
 
#define GLFW_POSITION_X   0x0002000E
 Initial position x-coordinate window hint. More...
 
#define GLFW_POSITION_Y   0x0002000F
 Initial position y-coordinate window hint. More...
 
#define GLFW_RED_BITS   0x00021001
 Framebuffer bit depth hint. More...
 
#define GLFW_GREEN_BITS   0x00021002
 Framebuffer bit depth hint. More...
 
#define GLFW_BLUE_BITS   0x00021003
 Framebuffer bit depth hint. More...
 
#define GLFW_ALPHA_BITS   0x00021004
 Framebuffer bit depth hint. More...
 
#define GLFW_DEPTH_BITS   0x00021005
 Framebuffer bit depth hint. More...
 
#define GLFW_STENCIL_BITS   0x00021006
 Framebuffer bit depth hint. More...
 
#define GLFW_ACCUM_RED_BITS   0x00021007
 Framebuffer bit depth hint. More...
 
#define GLFW_ACCUM_GREEN_BITS   0x00021008
 Framebuffer bit depth hint. More...
 
#define GLFW_ACCUM_BLUE_BITS   0x00021009
 Framebuffer bit depth hint. More...
 
#define GLFW_ACCUM_ALPHA_BITS   0x0002100A
 Framebuffer bit depth hint. More...
 
#define GLFW_AUX_BUFFERS   0x0002100B
 Framebuffer auxiliary buffer hint. More...
 
#define GLFW_STEREO   0x0002100C
 OpenGL stereoscopic rendering hint. More...
 
#define GLFW_SAMPLES   0x0002100D
 Framebuffer MSAA samples hint. More...
 
#define GLFW_SRGB_CAPABLE   0x0002100E
 Framebuffer sRGB hint. More...
 
#define GLFW_REFRESH_RATE   0x0002100F
 Monitor refresh rate hint. More...
 
#define GLFW_DOUBLEBUFFER   0x00021010
 Framebuffer double buffering hint and attribute. More...
 
#define GLFW_CLIENT_API   0x00022001
 Context client API hint and attribute. More...
 
#define GLFW_CONTEXT_VERSION_MAJOR   0x00022002
 Context client API major version hint and attribute. More...
 
#define GLFW_CONTEXT_VERSION_MINOR   0x00022003
 Context client API minor version hint and attribute. More...
 
#define GLFW_CONTEXT_REVISION   0x00022004
 Context client API revision number attribute. More...
 
#define GLFW_CONTEXT_ROBUSTNESS   0x00022005
 Context robustness hint and attribute. More...
 
#define GLFW_OPENGL_FORWARD_COMPAT   0x00022006
 OpenGL forward-compatibility hint and attribute. More...
 
#define GLFW_CONTEXT_DEBUG   0x00022007
 Debug mode context hint and attribute. More...
 
#define GLFW_OPENGL_DEBUG_CONTEXT   GLFW_CONTEXT_DEBUG
 Legacy name for compatibility. More...
 
#define GLFW_OPENGL_PROFILE   0x00022008
 OpenGL profile hint and attribute. More...
 
#define GLFW_CONTEXT_RELEASE_BEHAVIOR   0x00022009
 Context flush-on-release hint and attribute. More...
 
#define GLFW_CONTEXT_NO_ERROR   0x0002200A
 Context error suppression hint and attribute. More...
 
#define GLFW_CONTEXT_CREATION_API   0x0002200B
 Context creation API hint and attribute. More...
 
#define GLFW_SCALE_TO_MONITOR   0x0002200C
 Window content area scaling window window hint.
 
#define GLFW_SCALE_FRAMEBUFFER   0x0002200D
 Window framebuffer scaling window hint.
 
#define GLFW_COCOA_RETINA_FRAMEBUFFER   0x00023001
 Legacy name for compatibility. More...
 
#define GLFW_COCOA_FRAME_NAME   0x00023002
 macOS specific window hint.
 
#define GLFW_COCOA_GRAPHICS_SWITCHING   0x00023003
 macOS specific window hint.
 
#define GLFW_X11_CLASS_NAME   0x00024001
 X11 specific window hint.
 
#define GLFW_X11_INSTANCE_NAME   0x00024002
 X11 specific window hint.
 
#define GLFW_WIN32_KEYBOARD_MENU   0x00025001
 
#define GLFW_WIN32_SHOWDEFAULT   0x00025002
 Win32 specific window hint.
 
#define GLFW_WAYLAND_APP_ID   0x00026001
 Wayland specific window hint. More...
 

Typedefs

typedef struct GLFWwindow GLFWwindow
 Opaque window object. More...
 
typedef void(* GLFWwindowposfun) (GLFWwindow *window, int xpos, int ypos)
 The function pointer type for window position callbacks. More...
 
typedef void(* GLFWwindowsizefun) (GLFWwindow *window, int width, int height)
 The function pointer type for window size callbacks. More...
 
typedef void(* GLFWwindowclosefun) (GLFWwindow *window)
 The function pointer type for window close callbacks. More...
 
typedef void(* GLFWwindowrefreshfun) (GLFWwindow *window)
 The function pointer type for window content refresh callbacks. More...
 
typedef void(* GLFWwindowfocusfun) (GLFWwindow *window, int focused)
 The function pointer type for window focus callbacks. More...
 
typedef void(* GLFWwindowiconifyfun) (GLFWwindow *window, int iconified)
 The function pointer type for window iconify callbacks. More...
 
typedef void(* GLFWwindowmaximizefun) (GLFWwindow *window, int maximized)
 The function pointer type for window maximize callbacks. More...
 
typedef void(* GLFWframebuffersizefun) (GLFWwindow *window, int width, int height)
 The function pointer type for framebuffer size callbacks. More...
 
typedef void(* GLFWwindowcontentscalefun) (GLFWwindow *window, float xscale, float yscale)
 The function pointer type for window content scale callbacks. More...
 
typedef struct GLFWimage GLFWimage
 Image data. More...
 
typedef struct GLFWwindow GLFWwindow
 Opaque window object. More...
 
typedef void(* GLFWwindowposfun) (GLFWwindow *window, int xpos, int ypos)
 The function pointer type for window position callbacks. More...
 
typedef void(* GLFWwindowsizefun) (GLFWwindow *window, int width, int height)
 The function pointer type for window size callbacks. More...
 
typedef void(* GLFWwindowclosefun) (GLFWwindow *window)
 The function pointer type for window close callbacks. More...
 
typedef void(* GLFWwindowrefreshfun) (GLFWwindow *window)
 The function pointer type for window content refresh callbacks. More...
 
typedef void(* GLFWwindowfocusfun) (GLFWwindow *window, int focused)
 The function pointer type for window focus callbacks. More...
 
typedef void(* GLFWwindowiconifyfun) (GLFWwindow *window, int iconified)
 The function pointer type for window iconify callbacks. More...
 
typedef void(* GLFWwindowmaximizefun) (GLFWwindow *window, int maximized)
 The function pointer type for window maximize callbacks. More...
 
typedef void(* GLFWframebuffersizefun) (GLFWwindow *window, int width, int height)
 The function pointer type for framebuffer size callbacks. More...
 
typedef void(* GLFWwindowcontentscalefun) (GLFWwindow *window, float xscale, float yscale)
 The function pointer type for window content scale callbacks. More...
 
typedef struct GLFWimage GLFWimage
 Image data. More...
 

Functions

GLFWAPI void glfwDefaultWindowHints (void)
 Resets all window hints to their default values. More...
 
GLFWAPI void glfwWindowHint (int hint, int value)
 Sets the specified window hint to the desired value. More...
 
GLFWAPI void glfwWindowHintString (int hint, const char *value)
 Sets the specified window hint to the desired value. More...
 
GLFWAPI GLFWwindowglfwCreateWindow (int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)
 Creates a window and its associated context. More...
 
GLFWAPI void glfwDestroyWindow (GLFWwindow *window)
 Destroys the specified window and its context. More...
 
GLFWAPI int glfwWindowShouldClose (GLFWwindow *window)
 Checks the close flag of the specified window. More...
 
GLFWAPI void glfwSetWindowShouldClose (GLFWwindow *window, int value)
 Sets the close flag of the specified window. More...
 
GLFWAPI void glfwSetWindowTitle (GLFWwindow *window, const char *title)
 Sets the title of the specified window. More...
 
GLFWAPI void glfwSetWindowIcon (GLFWwindow *window, int count, const GLFWimage *images)
 Sets the icon for the specified window. More...
 
GLFWAPI void glfwGetWindowPos (GLFWwindow *window, int *xpos, int *ypos)
 Retrieves the position of the content area of the specified window. More...
 
GLFWAPI void glfwSetWindowPos (GLFWwindow *window, int xpos, int ypos)
 Sets the position of the content area of the specified window. More...
 
GLFWAPI void glfwGetWindowSize (GLFWwindow *window, int *width, int *height)
 Retrieves the size of the content area of the specified window. More...
 
GLFWAPI void glfwSetWindowSizeLimits (GLFWwindow *window, int minwidth, int minheight, int maxwidth, int maxheight)
 Sets the size limits of the specified window. More...
 
GLFWAPI void glfwSetWindowAspectRatio (GLFWwindow *window, int numer, int denom)
 Sets the aspect ratio of the specified window. More...
 
GLFWAPI void glfwSetWindowSize (GLFWwindow *window, int width, int height)
 Sets the size of the content area of the specified window. More...
 
GLFWAPI void glfwGetFramebufferSize (GLFWwindow *window, int *width, int *height)
 Retrieves the size of the framebuffer of the specified window. More...
 
GLFWAPI void glfwGetWindowFrameSize (GLFWwindow *window, int *left, int *top, int *right, int *bottom)
 Retrieves the size of the frame of the window. More...
 
GLFWAPI void glfwGetWindowContentScale (GLFWwindow *window, float *xscale, float *yscale)
 Retrieves the content scale for the specified window. More...
 
GLFWAPI float glfwGetWindowOpacity (GLFWwindow *window)
 Returns the opacity of the whole window. More...
 
GLFWAPI void glfwSetWindowOpacity (GLFWwindow *window, float opacity)
 Sets the opacity of the whole window. More...
 
GLFWAPI void glfwIconifyWindow (GLFWwindow *window)
 Iconifies the specified window. More...
 
GLFWAPI void glfwRestoreWindow (GLFWwindow *window)
 Restores the specified window. More...
 
GLFWAPI void glfwMaximizeWindow (GLFWwindow *window)
 Maximizes the specified window. More...
 
GLFWAPI void glfwShowWindow (GLFWwindow *window)
 Makes the specified window visible. More...
 
GLFWAPI void glfwHideWindow (GLFWwindow *window)
 Hides the specified window. More...
 
GLFWAPI void glfwFocusWindow (GLFWwindow *window)
 Brings the specified window to front and sets input focus. More...
 
GLFWAPI void glfwRequestWindowAttention (GLFWwindow *window)
 Requests user attention to the specified window. More...
 
GLFWAPI GLFWmonitorglfwGetWindowMonitor (GLFWwindow *window)
 Returns the monitor that the window uses for full screen mode. More...
 
GLFWAPI void glfwSetWindowMonitor (GLFWwindow *window, GLFWmonitor *monitor, int xpos, int ypos, int width, int height, int refreshRate)
 Sets the mode, monitor, video mode and placement of a window. More...
 
GLFWAPI int glfwGetWindowAttrib (GLFWwindow *window, int attrib)
 Returns an attribute of the specified window. More...
 
GLFWAPI void glfwSetWindowAttrib (GLFWwindow *window, int attrib, int value)
 Sets an attribute of the specified window. More...
 
GLFWAPI void glfwSetWindowUserPointer (GLFWwindow *window, void *pointer)
 Sets the user pointer of the specified window. More...
 
GLFWAPI void * glfwGetWindowUserPointer (GLFWwindow *window)
 Returns the user pointer of the specified window. More...
 
GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback (GLFWwindow *window, GLFWwindowposfun callback)
 Sets the position callback for the specified window. More...
 
GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback (GLFWwindow *window, GLFWwindowsizefun callback)
 Sets the size callback for the specified window. More...
 
GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback (GLFWwindow *window, GLFWwindowclosefun callback)
 Sets the close callback for the specified window. More...
 
GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback (GLFWwindow *window, GLFWwindowrefreshfun callback)
 Sets the refresh callback for the specified window. More...
 
GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback (GLFWwindow *window, GLFWwindowfocusfun callback)
 Sets the focus callback for the specified window. More...
 
GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback (GLFWwindow *window, GLFWwindowiconifyfun callback)
 Sets the iconify callback for the specified window. More...
 
GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback (GLFWwindow *window, GLFWwindowmaximizefun callback)
 Sets the maximize callback for the specified window. More...
 
GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback (GLFWwindow *window, GLFWframebuffersizefun callback)
 Sets the framebuffer resize callback for the specified window. More...
 
GLFWAPI GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback (GLFWwindow *window, GLFWwindowcontentscalefun callback)
 Sets the window content scale callback for the specified window. More...
 
GLFWAPI void glfwPollEvents (void)
 Processes all pending events. More...
 
GLFWAPI void glfwWaitEvents (void)
 Waits until events are queued and processes them. More...
 
GLFWAPI void glfwWaitEventsTimeout (double timeout)
 Waits with timeout until events are queued and processes them. More...
 
GLFWAPI void glfwPostEmptyEvent (void)
 Posts an empty event to the event queue. More...
 
GLFWAPI void glfwSwapBuffers (GLFWwindow *window)
 Swaps the front and back buffers of the specified window. More...
 
GLFWAPI const char * glfwGetWindowTitle (GLFWwindow *window)
 Returns the title of the specified window. More...
 

Detailed Description

Functions and types related to windows.

This is the reference documentation for window related functions and types, including creation, deletion and event polling. For more task-oriented information, see the window_guide.

Macro Definition Documentation

◆ GLFW_ACCUM_ALPHA_BITS [1/2]

#define GLFW_ACCUM_ALPHA_BITS   0x0002100A

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_ACCUM_ALPHA_BITS [2/2]

#define GLFW_ACCUM_ALPHA_BITS   0x0002100A

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_ACCUM_BLUE_BITS [1/2]

#define GLFW_ACCUM_BLUE_BITS   0x00021009

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_ACCUM_BLUE_BITS [2/2]

#define GLFW_ACCUM_BLUE_BITS   0x00021009

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_ACCUM_GREEN_BITS [1/2]

#define GLFW_ACCUM_GREEN_BITS   0x00021008

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_ACCUM_GREEN_BITS [2/2]

#define GLFW_ACCUM_GREEN_BITS   0x00021008

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_ACCUM_RED_BITS [1/2]

#define GLFW_ACCUM_RED_BITS   0x00021007

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_ACCUM_RED_BITS [2/2]

#define GLFW_ACCUM_RED_BITS   0x00021007

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_ALPHA_BITS [1/2]

#define GLFW_ALPHA_BITS   0x00021004

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_ALPHA_BITS [2/2]

#define GLFW_ALPHA_BITS   0x00021004

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_AUTO_ICONIFY [1/2]

#define GLFW_AUTO_ICONIFY   0x00020006

Window auto-iconification window hint and attribute.

Window auto-iconification window hint and window attribute.

◆ GLFW_AUTO_ICONIFY [2/2]

#define GLFW_AUTO_ICONIFY   0x00020006

Window auto-iconification window hint and attribute.

Window auto-iconification window hint and window attribute.

◆ GLFW_AUX_BUFFERS [1/2]

#define GLFW_AUX_BUFFERS   0x0002100B

Framebuffer auxiliary buffer hint.

Framebuffer auxiliary buffer hint.

◆ GLFW_AUX_BUFFERS [2/2]

#define GLFW_AUX_BUFFERS   0x0002100B

Framebuffer auxiliary buffer hint.

Framebuffer auxiliary buffer hint.

◆ GLFW_BLUE_BITS [1/2]

#define GLFW_BLUE_BITS   0x00021003

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_BLUE_BITS [2/2]

#define GLFW_BLUE_BITS   0x00021003

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_CENTER_CURSOR [1/2]

#define GLFW_CENTER_CURSOR   0x00020009

Cursor centering window hint.

Cursor centering window hint.

◆ GLFW_CENTER_CURSOR [2/2]

#define GLFW_CENTER_CURSOR   0x00020009

Cursor centering window hint.

Cursor centering window hint.

◆ GLFW_CLIENT_API [1/2]

#define GLFW_CLIENT_API   0x00022001

Context client API hint and attribute.

Context client API hint and attribute.

◆ GLFW_CLIENT_API [2/2]

#define GLFW_CLIENT_API   0x00022001

Context client API hint and attribute.

Context client API hint and attribute.

◆ GLFW_COCOA_RETINA_FRAMEBUFFER

#define GLFW_COCOA_RETINA_FRAMEBUFFER   0x00023001

Legacy name for compatibility.

This is an alias for the GLFW_SCALE_FRAMEBUFFER window hint for compatibility with earlier versions.

◆ GLFW_CONTEXT_CREATION_API [1/2]

#define GLFW_CONTEXT_CREATION_API   0x0002200B

Context creation API hint and attribute.

Context creation API hint and attribute.

◆ GLFW_CONTEXT_CREATION_API [2/2]

#define GLFW_CONTEXT_CREATION_API   0x0002200B

Context creation API hint and attribute.

Context creation API hint and attribute.

◆ GLFW_CONTEXT_DEBUG

#define GLFW_CONTEXT_DEBUG   0x00022007

Debug mode context hint and attribute.

Debug mode context hint and attribute.

◆ GLFW_CONTEXT_NO_ERROR [1/2]

#define GLFW_CONTEXT_NO_ERROR   0x0002200A

Context error suppression hint and attribute.

Context error suppression hint and attribute.

◆ GLFW_CONTEXT_NO_ERROR [2/2]

#define GLFW_CONTEXT_NO_ERROR   0x0002200A

Context error suppression hint and attribute.

Context error suppression hint and attribute.

◆ GLFW_CONTEXT_RELEASE_BEHAVIOR [1/2]

#define GLFW_CONTEXT_RELEASE_BEHAVIOR   0x00022009

Context flush-on-release hint and attribute.

Context flush-on-release hint and attribute.

◆ GLFW_CONTEXT_RELEASE_BEHAVIOR [2/2]

#define GLFW_CONTEXT_RELEASE_BEHAVIOR   0x00022009

Context flush-on-release hint and attribute.

Context flush-on-release hint and attribute.

◆ GLFW_CONTEXT_REVISION [1/2]

#define GLFW_CONTEXT_REVISION   0x00022004

Context client API revision number attribute.

Context client API revision number attribute.

◆ GLFW_CONTEXT_REVISION [2/2]

#define GLFW_CONTEXT_REVISION   0x00022004

Context client API revision number attribute.

Context client API revision number attribute.

◆ GLFW_CONTEXT_ROBUSTNESS [1/2]

#define GLFW_CONTEXT_ROBUSTNESS   0x00022005

Context robustness hint and attribute.

Context client API revision number hint and attribute.

◆ GLFW_CONTEXT_ROBUSTNESS [2/2]

#define GLFW_CONTEXT_ROBUSTNESS   0x00022005

Context robustness hint and attribute.

Context client API revision number hint and attribute.

◆ GLFW_CONTEXT_VERSION_MAJOR [1/2]

#define GLFW_CONTEXT_VERSION_MAJOR   0x00022002

Context client API major version hint and attribute.

Context client API major version hint and attribute.

◆ GLFW_CONTEXT_VERSION_MAJOR [2/2]

#define GLFW_CONTEXT_VERSION_MAJOR   0x00022002

Context client API major version hint and attribute.

Context client API major version hint and attribute.

◆ GLFW_CONTEXT_VERSION_MINOR [1/2]

#define GLFW_CONTEXT_VERSION_MINOR   0x00022003

Context client API minor version hint and attribute.

Context client API minor version hint and attribute.

◆ GLFW_CONTEXT_VERSION_MINOR [2/2]

#define GLFW_CONTEXT_VERSION_MINOR   0x00022003

Context client API minor version hint and attribute.

Context client API minor version hint and attribute.

◆ GLFW_DECORATED [1/2]

#define GLFW_DECORATED   0x00020005

Window decoration window hint and attribute.

Window decoration window hint and window attribute.

◆ GLFW_DECORATED [2/2]

#define GLFW_DECORATED   0x00020005

Window decoration window hint and attribute.

Window decoration window hint and window attribute.

◆ GLFW_DEPTH_BITS [1/2]

#define GLFW_DEPTH_BITS   0x00021005

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_DEPTH_BITS [2/2]

#define GLFW_DEPTH_BITS   0x00021005

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_DOUBLEBUFFER [1/2]

#define GLFW_DOUBLEBUFFER   0x00021010

Framebuffer double buffering hint.

Framebuffer double buffering hint.

◆ GLFW_DOUBLEBUFFER [2/2]

#define GLFW_DOUBLEBUFFER   0x00021010

Framebuffer double buffering hint and attribute.

Framebuffer double buffering hint and attribute.

◆ GLFW_FLOATING [1/2]

#define GLFW_FLOATING   0x00020007

Window decoration window hint and attribute.

Window decoration window hint and window attribute.

◆ GLFW_FLOATING [2/2]

#define GLFW_FLOATING   0x00020007

Window decoration window hint and attribute.

Window decoration window hint and window attribute.

◆ GLFW_FOCUS_ON_SHOW [1/2]

#define GLFW_FOCUS_ON_SHOW   0x0002000C

Input focus on calling show window hint and attribute.

Input focus window hint or window attribute.

◆ GLFW_FOCUS_ON_SHOW [2/2]

#define GLFW_FOCUS_ON_SHOW   0x0002000C

Input focus on calling show window hint and attribute.

Input focus window hint or window attribute.

◆ GLFW_FOCUSED [1/2]

#define GLFW_FOCUSED   0x00020001

Input focus window hint and attribute.

Input focus window hint or window attribute.

◆ GLFW_FOCUSED [2/2]

#define GLFW_FOCUSED   0x00020001

Input focus window hint and attribute.

Input focus window hint or window attribute.

◆ GLFW_GREEN_BITS [1/2]

#define GLFW_GREEN_BITS   0x00021002

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_GREEN_BITS [2/2]

#define GLFW_GREEN_BITS   0x00021002

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_HOVERED [1/2]

#define GLFW_HOVERED   0x0002000B

Mouse cursor hover window attribute.

Mouse cursor hover window attribute.

◆ GLFW_HOVERED [2/2]

#define GLFW_HOVERED   0x0002000B

Mouse cursor hover window attribute.

Mouse cursor hover window attribute.

◆ GLFW_ICONIFIED [1/2]

#define GLFW_ICONIFIED   0x00020002

Window iconification window attribute.

Window iconification window attribute.

◆ GLFW_ICONIFIED [2/2]

#define GLFW_ICONIFIED   0x00020002

Window iconification window attribute.

Window iconification window attribute.

◆ GLFW_MAXIMIZED [1/2]

#define GLFW_MAXIMIZED   0x00020008

Window maximization window hint and attribute.

Window maximization window hint and window attribute.

◆ GLFW_MAXIMIZED [2/2]

#define GLFW_MAXIMIZED   0x00020008

Window maximization window hint and attribute.

Window maximization window hint and window attribute.

◆ GLFW_MOUSE_PASSTHROUGH

#define GLFW_MOUSE_PASSTHROUGH   0x0002000D

Mouse input transparency window hint and attribute.

Mouse input transparency window hint or window attribute.

◆ GLFW_OPENGL_DEBUG_CONTEXT [1/2]

#define GLFW_OPENGL_DEBUG_CONTEXT   0x00022007

Debug mode context hint and attribute.

Debug mode context hint and attribute.

◆ GLFW_OPENGL_DEBUG_CONTEXT [2/2]

#define GLFW_OPENGL_DEBUG_CONTEXT   GLFW_CONTEXT_DEBUG

Legacy name for compatibility.

This is an alias for compatibility with earlier versions.

◆ GLFW_OPENGL_FORWARD_COMPAT [1/2]

#define GLFW_OPENGL_FORWARD_COMPAT   0x00022006

OpenGL forward-compatibility hint and attribute.

OpenGL forward-compatibility hint and attribute.

◆ GLFW_OPENGL_FORWARD_COMPAT [2/2]

#define GLFW_OPENGL_FORWARD_COMPAT   0x00022006

OpenGL forward-compatibility hint and attribute.

OpenGL forward-compatibility hint and attribute.

◆ GLFW_OPENGL_PROFILE [1/2]

#define GLFW_OPENGL_PROFILE   0x00022008

OpenGL profile hint and attribute.

OpenGL profile hint and attribute.

◆ GLFW_OPENGL_PROFILE [2/2]

#define GLFW_OPENGL_PROFILE   0x00022008

OpenGL profile hint and attribute.

OpenGL profile hint and attribute.

◆ GLFW_POSITION_X

#define GLFW_POSITION_X   0x0002000E

Initial position x-coordinate window hint.

Initial position x-coordinate window hint.

◆ GLFW_POSITION_Y

#define GLFW_POSITION_Y   0x0002000F

Initial position y-coordinate window hint.

Initial position y-coordinate window hint.

◆ GLFW_RED_BITS [1/2]

#define GLFW_RED_BITS   0x00021001

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_RED_BITS [2/2]

#define GLFW_RED_BITS   0x00021001

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_REFRESH_RATE [1/2]

#define GLFW_REFRESH_RATE   0x0002100F

Monitor refresh rate hint.

Monitor refresh rate hint.

◆ GLFW_REFRESH_RATE [2/2]

#define GLFW_REFRESH_RATE   0x0002100F

Monitor refresh rate hint.

Monitor refresh rate hint.

◆ GLFW_RESIZABLE [1/2]

#define GLFW_RESIZABLE   0x00020003

Window resize-ability window hint and attribute.

Window resize-ability window hint and window attribute.

◆ GLFW_RESIZABLE [2/2]

#define GLFW_RESIZABLE   0x00020003

Window resize-ability window hint and attribute.

Window resize-ability window hint and window attribute.

◆ GLFW_SAMPLES [1/2]

#define GLFW_SAMPLES   0x0002100D

Framebuffer MSAA samples hint.

Framebuffer MSAA samples hint.

◆ GLFW_SAMPLES [2/2]

#define GLFW_SAMPLES   0x0002100D

Framebuffer MSAA samples hint.

Framebuffer MSAA samples hint.

◆ GLFW_SRGB_CAPABLE [1/2]

#define GLFW_SRGB_CAPABLE   0x0002100E

Framebuffer sRGB hint.

Framebuffer sRGB hint.

◆ GLFW_SRGB_CAPABLE [2/2]

#define GLFW_SRGB_CAPABLE   0x0002100E

Framebuffer sRGB hint.

Framebuffer sRGB hint.

◆ GLFW_STENCIL_BITS [1/2]

#define GLFW_STENCIL_BITS   0x00021006

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_STENCIL_BITS [2/2]

#define GLFW_STENCIL_BITS   0x00021006

Framebuffer bit depth hint.

Framebuffer bit depth hint.

◆ GLFW_STEREO [1/2]

#define GLFW_STEREO   0x0002100C

OpenGL stereoscopic rendering hint.

OpenGL stereoscopic rendering hint.

◆ GLFW_STEREO [2/2]

#define GLFW_STEREO   0x0002100C

OpenGL stereoscopic rendering hint.

OpenGL stereoscopic rendering hint.

◆ GLFW_TRANSPARENT_FRAMEBUFFER [1/2]

#define GLFW_TRANSPARENT_FRAMEBUFFER   0x0002000A

Window framebuffer transparency hint and attribute.

Window framebuffer transparency window hint and window attribute.

◆ GLFW_TRANSPARENT_FRAMEBUFFER [2/2]

#define GLFW_TRANSPARENT_FRAMEBUFFER   0x0002000A

Window framebuffer transparency hint and attribute.

Window framebuffer transparency window hint and window attribute.

◆ GLFW_VISIBLE [1/2]

#define GLFW_VISIBLE   0x00020004

Window visibility window hint and attribute.

Window visibility window hint and window attribute.

◆ GLFW_VISIBLE [2/2]

#define GLFW_VISIBLE   0x00020004

Window visibility window hint and attribute.

Window visibility window hint and window attribute.

◆ GLFW_WAYLAND_APP_ID

#define GLFW_WAYLAND_APP_ID   0x00026001

Wayland specific window hint.

Allows specification of the Wayland app_id.

Typedef Documentation

◆ GLFWframebuffersizefun [1/2]

typedef void(* GLFWframebuffersizefun) (GLFWwindow *window, int width, int height)

The function pointer type for framebuffer size callbacks.

This is the function pointer type for framebuffer size callbacks. A framebuffer size callback function has the following signature:

void function_name(GLFWwindow* window, int width, int height)
Parameters
[in]windowThe window whose framebuffer was resized.
[in]widthThe new width, in pixels, of the framebuffer.
[in]heightThe new height, in pixels, of the framebuffer.
See also
window_fbsize
glfwSetFramebufferSizeCallback
Since
Added in version 3.0.

◆ GLFWframebuffersizefun [2/2]

typedef void(* GLFWframebuffersizefun) (GLFWwindow *window, int width, int height)

The function pointer type for framebuffer size callbacks.

This is the function pointer type for framebuffer size callbacks. A framebuffer size callback function has the following signature:

void function_name(GLFWwindow* window, int width, int height)
Parameters
[in]windowThe window whose framebuffer was resized.
[in]widthThe new width, in pixels, of the framebuffer.
[in]heightThe new height, in pixels, of the framebuffer.
See also
window_fbsize
glfwSetFramebufferSizeCallback
Since
Added in version 3.0.

◆ GLFWimage [1/2]

typedef struct GLFWimage GLFWimage

Image data.

This describes a single 2D image. See the documentation for each related function what the expected pixel format is.

See also
cursor_custom
window_icon
Since
Added in version 2.1. Removed format and bytes-per-pixel members.

◆ GLFWimage [2/2]

typedef struct GLFWimage GLFWimage

Image data.

This describes a single 2D image. See the documentation for each related function what the expected pixel format is.

See also
cursor_custom
window_icon
Since
Added in version 2.1. Removed format and bytes-per-pixel members.

◆ GLFWwindow [1/2]

typedef struct GLFWwindow GLFWwindow

Opaque window object.

Opaque window object.

See also
window_object
Since
Added in version 3.0.

◆ GLFWwindow [2/2]

typedef struct GLFWwindow GLFWwindow

Opaque window object.

Opaque window object.

See also
window_object
Since
Added in version 3.0.

◆ GLFWwindowclosefun [1/2]

typedef void(* GLFWwindowclosefun) (GLFWwindow *window)

The function pointer type for window close callbacks.

This is the function pointer type for window close callbacks. A window close callback function has the following signature:

void function_name(GLFWwindow* window)
Parameters
[in]windowThe window that the user attempted to close.
See also
window_close
glfwSetWindowCloseCallback
Since
Added in version 2.5. Added window handle parameter.

◆ GLFWwindowclosefun [2/2]

typedef void(* GLFWwindowclosefun) (GLFWwindow *window)

The function pointer type for window close callbacks.

This is the function pointer type for window close callbacks. A window close callback function has the following signature:

void function_name(GLFWwindow* window)
Parameters
[in]windowThe window that the user attempted to close.
See also
window_close
glfwSetWindowCloseCallback
Since
Added in version 2.5. Added window handle parameter.

◆ GLFWwindowcontentscalefun [1/2]

typedef void(* GLFWwindowcontentscalefun) (GLFWwindow *window, float xscale, float yscale)

The function pointer type for window content scale callbacks.

This is the function pointer type for window content scale callbacks. A window content scale callback function has the following signature:

void function_name(GLFWwindow* window, float xscale, float yscale)
Parameters
[in]windowThe window whose content scale changed.
[in]xscaleThe new x-axis content scale of the window.
[in]yscaleThe new y-axis content scale of the window.
See also
window_scale
glfwSetWindowContentScaleCallback
Since
Added in version 3.3.

◆ GLFWwindowcontentscalefun [2/2]

typedef void(* GLFWwindowcontentscalefun) (GLFWwindow *window, float xscale, float yscale)

The function pointer type for window content scale callbacks.

This is the function pointer type for window content scale callbacks. A window content scale callback function has the following signature:

void function_name(GLFWwindow* window, float xscale, float yscale)
Parameters
[in]windowThe window whose content scale changed.
[in]xscaleThe new x-axis content scale of the window.
[in]yscaleThe new y-axis content scale of the window.
See also
window_scale
glfwSetWindowContentScaleCallback
Since
Added in version 3.3.

◆ GLFWwindowfocusfun [1/2]

typedef void(* GLFWwindowfocusfun) (GLFWwindow *window, int focused)

The function pointer type for window focus callbacks.

This is the function pointer type for window focus callbacks. A window focus callback function has the following signature:

void function_name(GLFWwindow* window, int focused)
Parameters
[in]windowThe window that gained or lost input focus.
[in]focusedGLFW_TRUE if the window was given input focus, or GLFW_FALSE if it lost it.
See also
window_focus
glfwSetWindowFocusCallback
Since
Added in version 3.0.

◆ GLFWwindowfocusfun [2/2]

typedef void(* GLFWwindowfocusfun) (GLFWwindow *window, int focused)

The function pointer type for window focus callbacks.

This is the function pointer type for window focus callbacks. A window focus callback function has the following signature:

void function_name(GLFWwindow* window, int focused)
Parameters
[in]windowThe window that gained or lost input focus.
[in]focusedGLFW_TRUE if the window was given input focus, or GLFW_FALSE if it lost it.
See also
window_focus
glfwSetWindowFocusCallback
Since
Added in version 3.0.

◆ GLFWwindowiconifyfun [1/2]

typedef void(* GLFWwindowiconifyfun) (GLFWwindow *window, int iconified)

The function pointer type for window iconify callbacks.

This is the function pointer type for window iconify callbacks. A window iconify callback function has the following signature:

void function_name(GLFWwindow* window, int iconified)
Parameters
[in]windowThe window that was iconified or restored.
[in]iconifiedGLFW_TRUE if the window was iconified, or GLFW_FALSE if it was restored.
See also
window_iconify
glfwSetWindowIconifyCallback
Since
Added in version 3.0.

◆ GLFWwindowiconifyfun [2/2]

typedef void(* GLFWwindowiconifyfun) (GLFWwindow *window, int iconified)

The function pointer type for window iconify callbacks.

This is the function pointer type for window iconify callbacks. A window iconify callback function has the following signature:

void function_name(GLFWwindow* window, int iconified)
Parameters
[in]windowThe window that was iconified or restored.
[in]iconifiedGLFW_TRUE if the window was iconified, or GLFW_FALSE if it was restored.
See also
window_iconify
glfwSetWindowIconifyCallback
Since
Added in version 3.0.

◆ GLFWwindowmaximizefun [1/2]

typedef void(* GLFWwindowmaximizefun) (GLFWwindow *window, int maximized)

The function pointer type for window maximize callbacks.

This is the function pointer type for window maximize callbacks. A window maximize callback function has the following signature:

void function_name(GLFWwindow* window, int maximized)
Parameters
[in]windowThe window that was maximized or restored.
[in]maximizedGLFW_TRUE if the window was maximized, or GLFW_FALSE if it was restored.
See also
window_maximize
glfwSetWindowMaximizeCallback
Since
Added in version 3.3.

◆ GLFWwindowmaximizefun [2/2]

typedef void(* GLFWwindowmaximizefun) (GLFWwindow *window, int maximized)

The function pointer type for window maximize callbacks.

This is the function pointer type for window maximize callbacks. A window maximize callback function has the following signature:

void function_name(GLFWwindow* window, int maximized)
Parameters
[in]windowThe window that was maximized or restored.
[in]maximizedGLFW_TRUE if the window was maximized, or GLFW_FALSE if it was restored.
See also
window_maximize
glfwSetWindowMaximizeCallback
Since
Added in version 3.3.

◆ GLFWwindowposfun [1/2]

typedef void(* GLFWwindowposfun) (GLFWwindow *window, int xpos, int ypos)

The function pointer type for window position callbacks.

This is the function pointer type for window position callbacks. A window position callback function has the following signature:

void callback_name(GLFWwindow* window, int xpos, int ypos)
Parameters
[in]windowThe window that was moved.
[in]xposThe new x-coordinate, in screen coordinates, of the upper-left corner of the content area of the window.
[in]yposThe new y-coordinate, in screen coordinates, of the upper-left corner of the content area of the window.
See also
window_pos
glfwSetWindowPosCallback
Since
Added in version 3.0.

◆ GLFWwindowposfun [2/2]

typedef void(* GLFWwindowposfun) (GLFWwindow *window, int xpos, int ypos)

The function pointer type for window position callbacks.

This is the function pointer type for window position callbacks. A window position callback function has the following signature:

void callback_name(GLFWwindow* window, int xpos, int ypos)
Parameters
[in]windowThe window that was moved.
[in]xposThe new x-coordinate, in screen coordinates, of the upper-left corner of the content area of the window.
[in]yposThe new y-coordinate, in screen coordinates, of the upper-left corner of the content area of the window.
See also
window_pos
glfwSetWindowPosCallback
Since
Added in version 3.0.

◆ GLFWwindowrefreshfun [1/2]

typedef void(* GLFWwindowrefreshfun) (GLFWwindow *window)

The function pointer type for window content refresh callbacks.

This is the function pointer type for window content refresh callbacks. A window content refresh callback function has the following signature:

void function_name(GLFWwindow* window);
Parameters
[in]windowThe window whose content needs to be refreshed.
See also
window_refresh
glfwSetWindowRefreshCallback
Since
Added in version 2.5. Added window handle parameter.

◆ GLFWwindowrefreshfun [2/2]

typedef void(* GLFWwindowrefreshfun) (GLFWwindow *window)

The function pointer type for window content refresh callbacks.

This is the function pointer type for window content refresh callbacks. A window content refresh callback function has the following signature:

void function_name(GLFWwindow* window);
Parameters
[in]windowThe window whose content needs to be refreshed.
See also
window_refresh
glfwSetWindowRefreshCallback
Since
Added in version 2.5. Added window handle parameter.

◆ GLFWwindowsizefun [1/2]

typedef void(* GLFWwindowsizefun) (GLFWwindow *window, int width, int height)

The function pointer type for window size callbacks.

This is the function pointer type for window size callbacks. A window size callback function has the following signature:

void callback_name(GLFWwindow* window, int width, int height)
Parameters
[in]windowThe window that was resized.
[in]widthThe new width, in screen coordinates, of the window.
[in]heightThe new height, in screen coordinates, of the window.
See also
window_size
glfwSetWindowSizeCallback
Since
Added in version 1.0. Added window handle parameter.

◆ GLFWwindowsizefun [2/2]

typedef void(* GLFWwindowsizefun) (GLFWwindow *window, int width, int height)

The function pointer type for window size callbacks.

This is the function pointer type for window size callbacks. A window size callback function has the following signature:

void callback_name(GLFWwindow* window, int width, int height)
Parameters
[in]windowThe window that was resized.
[in]widthThe new width, in screen coordinates, of the window.
[in]heightThe new height, in screen coordinates, of the window.
See also
window_size
glfwSetWindowSizeCallback
Since
Added in version 1.0. Added window handle parameter.

Function Documentation

◆ glfwCreateWindow()

GLFWAPI GLFWwindow * glfwCreateWindow ( int  width,
int  height,
const char *  title,
GLFWmonitor monitor,
GLFWwindow share 
)

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 window hints.

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 share parameter, see context_sharing.

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 glfwGetWindowAttrib, glfwGetWindowSize and glfwGetFramebufferSize.

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 monitor_monitors.

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 window_windowed_full_screen.

Once you have created the window, you can switch it between windowed and full screen mode with glfwSetWindowMonitor. This will not affect its 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 GLFW_VISIBLE window hint, set its position and then show it.

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 actual size after creation.

The swap interval is not set during window creation and the initial value may vary depending on driver settings and defaults.

Parameters
[in]widthThe desired width, in screen coordinates, of the window. This must be greater than zero.
[in]heightThe desired height, in screen coordinates, of the window. This must be greater than zero.
[in]titleThe initial, UTF-8 encoded window title.
[in]monitorThe monitor to use for full screen mode, or NULL for windowed mode.
[in]shareThe window whose context to share resources with, or NULL to not share resources.
Returns
The handle of the created window, or NULL if an error occurred.

Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM, GLFW_INVALID_VALUE, GLFW_API_UNAVAILABLE, GLFW_VERSION_UNAVAILABLE, GLFW_FORMAT_UNAVAILABLE and GLFW_PLATFORM_ERROR.

Remarks
Window creation will fail if the Microsoft GDI software OpenGL implementation is the only one available.
If the executable has an icon resource named GLFW_ICON, it will be set as the initial icon for the window. If no such icon is present, the IDI_APPLICATION icon will be used instead. To set a different icon, see glfwSetWindowIcon.
The context to share resources with must not be current on any other thread.
The OS only supports forward-compatible core profile contexts for OpenGL versions 3.2 and later. Before creating an OpenGL context of version 3.2 or later you must set the GLFW_OPENGL_FORWARD_COMPAT and GLFW_OPENGL_PROFILE hints accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.
The GLFW window has no icon, as it is not a document window, but the dock icon will be the same as the application bundle's icon. For more information on bundles, see the Bundle Programming Guide in the Mac Developer Library.
The first time a window is created the menu bar is created. If GLFW finds a MainMenu.nib it is loaded and assumed to contain a menu bar. Otherwise a minimal menu bar is created manually with common commands like Hide, Quit and About. The About entry opens a minimal about dialog with information from the application's bundle. Menu bar creation can be disabled entirely with the GLFW_COCOA_MENUBAR init hint.
On OS X 10.10 and later the window frame will not be rendered at full resolution on Retina displays unless the GLFW_COCOA_RETINA_FRAMEBUFFER hint is GLFW_TRUE and the NSHighResolutionCapable key is enabled in the application bundle's Info.plist. For more information, see High Resolution Guidelines for OS X in the Mac Developer Library. The GLFW test and example programs use a custom Info.plist template for this, which can be found as CMake/MacOSXBundleInfo.plist.in in the source tree.
When activating frame autosaving with GLFW_COCOA_FRAME_NAME, the specified window size and position may be overridden by previously saved values.
Some window managers will not respect the placement of initially hidden windows.
Due to the asynchronous nature of X11, it may take a moment for a window to reach its requested state. This means you may not be able to query the final size, position or other attributes directly after window creation.
The class part of the WM_CLASS window property will by default be set to the window title passed to this function. The instance part will use the contents of the RESOURCE_NAME environment variable, if present and not empty, or fall back to the window title. Set the GLFW_X11_CLASS_NAME and GLFW_X11_INSTANCE_NAME window hints to override this.
Compositors should implement the xdg-decoration protocol for GLFW to decorate the window properly. If this protocol isn't supported, or if the compositor prefers client-side decorations, a very simple fallback frame will be drawn using the wp_viewporter protocol. A compositor can still emit close, maximize or fullscreen events, using for instance a keybind mechanism. If neither of these protocols is supported, the window won't be decorated.
A full screen window will not attempt to change the mode, no matter what the requested size or refresh rate.
Screensaver inhibition requires the idle-inhibit protocol to be implemented in the user's compositor.

This function must only be called from the main thread.

See also
window_creation
glfwDestroyWindow
Since
Added in version 3.0. Replaces glfwOpenWindow.

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 window hints.

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 share parameter, see context_sharing.

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 glfwGetWindowAttrib, glfwGetWindowSize and glfwGetFramebufferSize.

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 monitor_monitors.

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 window_windowed_full_screen.

Once you have created the window, you can switch it between windowed and full screen mode with glfwSetWindowMonitor. This will not affect its 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, set the GLFW_POSITION_X and GLFW_POSITION_Y window hints before creation. To restore the default behavior, set either or both hints back to GLFW_ANY_POSITION.

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 actual size after creation.

The swap interval is not set during window creation and the initial value may vary depending on driver settings and defaults.

Parameters
[in]widthThe desired width, in screen coordinates, of the window. This must be greater than zero.
[in]heightThe desired height, in screen coordinates, of the window. This must be greater than zero.
[in]titleThe initial, UTF-8 encoded window title.
[in]monitorThe monitor to use for full screen mode, or NULL for windowed mode.
[in]shareThe window whose context to share resources with, or NULL to not share resources.
Returns
The handle of the created window, or NULL if an error occurred.

Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM, GLFW_INVALID_VALUE, GLFW_API_UNAVAILABLE, GLFW_VERSION_UNAVAILABLE, GLFW_FORMAT_UNAVAILABLE, GLFW_NO_WINDOW_CONTEXT and GLFW_PLATFORM_ERROR.

Remarks
Window creation will fail if the Microsoft GDI software OpenGL implementation is the only one available.
If the executable has an icon resource named GLFW_ICON, it will be set as the initial icon for the window. If no such icon is present, the IDI_APPLICATION icon will be used instead. To set a different icon, see glfwSetWindowIcon.
The context to share resources with must not be current on any other thread.
The OS only supports core profile contexts for OpenGL versions 3.2 and later. Before creating an OpenGL context of version 3.2 or later you must set the GLFW_OPENGL_PROFILE hint accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.
The GLFW window has no icon, as it is not a document window, but the dock icon will be the same as the application bundle's icon. For more information on bundles, see the Bundle Programming Guide in the Mac Developer Library.
On OS X 10.10 and later the window frame will not be rendered at full resolution on Retina displays unless the GLFW_SCALE_FRAMEBUFFER hint is GLFW_TRUE and the NSHighResolutionCapable key is enabled in the application bundle's Info.plist. For more information, see High Resolution Guidelines for OS X in the Mac Developer Library. The GLFW test and example programs use a custom Info.plist template for this, which can be found as CMake/Info.plist.in in the source tree.
When activating frame autosaving with GLFW_COCOA_FRAME_NAME, the specified window size and position may be overridden by previously saved values.
GLFW uses libdecor where available to create its window decorations. This in turn uses server-side XDG decorations where available and provides high quality client-side decorations on compositors like GNOME. If both XDG decorations and libdecor are unavailable, GLFW falls back to a very simple set of window decorations that only support moving, resizing and the window manager's right-click menu.
Some window managers will not respect the placement of initially hidden windows.
Due to the asynchronous nature of X11, it may take a moment for a window to reach its requested state. This means you may not be able to query the final size, position or other attributes directly after window creation.
The class part of the WM_CLASS window property will by default be set to the window title passed to this function. The instance part will use the contents of the RESOURCE_NAME environment variable, if present and not empty, or fall back to the window title. Set the GLFW_X11_CLASS_NAME and GLFW_X11_INSTANCE_NAME window hints to override this.

This function must only be called from the main thread.

See also
window_creation
glfwDestroyWindow
Since
Added in version 3.0. Replaces glfwOpenWindow.

◆ glfwDefaultWindowHints()

GLFWAPI void glfwDefaultWindowHints ( void  )

Resets all window hints to their default values.

This function resets all window hints to their default values.

Possible errors include GLFW_NOT_INITIALIZED.

This function must only be called from the main thread.

See also
window_hints
glfwWindowHint
glfwWindowHintString
Since
Added in version 3.0.

◆ glfwDestroyWindow()

GLFWAPI void glfwDestroyWindow ( GLFWwindow window)

Destroys the specified window and its context.

This function destroys the specified window and its context. On calling this function, no further callbacks will be called for that window.

If the context of the specified window is current on the main thread, it is detached before being destroyed.

Parameters
[in]windowThe window to destroy.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Note
The context of the specified window must not be current on any other thread when this function is called.

This function must not be called from a callback.

This function must only be called from the main thread.

See also
window_creation
glfwCreateWindow
Since
Added in version 3.0. Replaces glfwCloseWindow.

◆ glfwFocusWindow()

GLFWAPI void glfwFocusWindow ( GLFWwindow window)

Brings the specified window to front and sets input focus.

This function brings the specified window to front and sets input focus. The window should already be visible and not iconified.

By default, both windowed and full screen mode windows are focused when initially created. Set the GLFW_FOCUSED to disable this behavior.

Also by default, windowed mode windows are focused when shown with glfwShowWindow. Set the GLFW_FOCUS_ON_SHOW to disable this behavior.

Do not use this function to steal focus from other applications unless you are certain that is what the user wants. Focus stealing can be extremely disruptive.

For a less disruptive way of getting the user's attention, see attention requests.

Parameters
[in]windowThe window to give input focus.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks
It is not possible for an application to bring its windows to front, this function will always emit GLFW_PLATFORM_ERROR.

This function must only be called from the main thread.

See also
window_focus
window_attention
Since
Added in version 3.2.

This function brings the specified window to front and sets input focus. The window should already be visible and not iconified.

By default, both windowed and full screen mode windows are focused when initially created. Set the GLFW_FOCUSED to disable this behavior.

Also by default, windowed mode windows are focused when shown with glfwShowWindow. Set the GLFW_FOCUS_ON_SHOW to disable this behavior.

Do not use this function to steal focus from other applications unless you are certain that is what the user wants. Focus stealing can be extremely disruptive.

For a less disruptive way of getting the user's attention, see attention requests.

Parameters
[in]windowThe window to give input focus.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks
The compositor will likely ignore focus requests unless another window created by the same application already has input focus.

This function must only be called from the main thread.

See also
window_focus
window_attention
Since
Added in version 3.2.

◆ glfwGetFramebufferSize()

GLFWAPI void glfwGetFramebufferSize ( GLFWwindow window,
int *  width,
int *  height 
)

Retrieves the size of the framebuffer of the specified window.

This function retrieves the size, in pixels, of the framebuffer of the specified window. If you wish to retrieve the size of the window in screen coordinates, see glfwGetWindowSize.

Any or all of the size arguments may be NULL. If an error occurs, all non-NULL size arguments will be set to zero.

Parameters
[in]windowThe window whose framebuffer to query.
[out]widthWhere to store the width, in pixels, of the framebuffer, or NULL.
[out]heightWhere to store the height, in pixels, of the framebuffer, or NULL.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

This function must only be called from the main thread.

See also
window_fbsize
glfwSetFramebufferSizeCallback
Since
Added in version 3.0.

◆ glfwGetWindowAttrib()

GLFWAPI int glfwGetWindowAttrib ( GLFWwindow window,
int  attrib 
)

Returns an attribute of the specified window.

This function returns the value of an attribute of the specified window or its OpenGL or OpenGL ES context.

Parameters
[in]windowThe window to query.
[in]attribThe window attribute whose value to return.
Returns
The value of the attribute, or zero if an error occurred.

Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM and GLFW_PLATFORM_ERROR.

Remarks
Framebuffer related hints are not window attributes. See window_attribs_fb for more information.
Zero is a valid value for many window and context related attributes so you cannot use a return value of zero as an indication of errors. However, this function should not fail as long as it is passed valid arguments and the library has been initialized.
The Wayland protocol provides no way to check whether a window is iconfied, so GLFW_ICONIFIED always returns GLFW_FALSE.

This function must only be called from the main thread.

See also
window_attribs
glfwSetWindowAttrib
Since
Added in version 3.0. Replaces glfwGetWindowParam and glfwGetGLVersion.

◆ glfwGetWindowContentScale()

GLFWAPI void glfwGetWindowContentScale ( GLFWwindow window,
float *  xscale,
float *  yscale 
)

Retrieves the content scale for the specified window.

This function retrieves the content scale for the specified window. The content scale is the ratio between the current DPI and the platform's default DPI. This is especially important for text and any UI elements. If the pixel dimensions of your UI scaled by this look appropriate on your machine then it should appear at a reasonable size on other machines regardless of their DPI and scaling settings. This relies on the system DPI and scaling settings being somewhat correct.

On systems where each monitors can have its own content scale, the window content scale will depend on which monitor the system considers the window to be on.

Parameters
[in]windowThe window to query.
[out]xscaleWhere to store the x-axis content scale, or NULL.
[out]yscaleWhere to store the y-axis content scale, or NULL.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

This function must only be called from the main thread.

See also
window_scale
glfwSetWindowContentScaleCallback
glfwGetMonitorContentScale
Since
Added in version 3.3.

This function retrieves the content scale for the specified window. The content scale is the ratio between the current DPI and the platform's default DPI. This is especially important for text and any UI elements. If the pixel dimensions of your UI scaled by this look appropriate on your machine then it should appear at a reasonable size on other machines regardless of their DPI and scaling settings. This relies on the system DPI and scaling settings being somewhat correct.

On platforms where each monitors can have its own content scale, the window content scale will depend on which monitor the system considers the window to be on.

Parameters
[in]windowThe window to query.
[out]xscaleWhere to store the x-axis content scale, or NULL.
[out]yscaleWhere to store the y-axis content scale, or NULL.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

This function must only be called from the main thread.

See also
window_scale
glfwSetWindowContentScaleCallback
glfwGetMonitorContentScale
Since
Added in version 3.3.

◆ glfwGetWindowFrameSize()

GLFWAPI void glfwGetWindowFrameSize ( GLFWwindow window,
int *  left,
int *  top,
int *  right,
int *  bottom 
)

Retrieves the size of the frame of the window.

This function retrieves the size, in screen coordinates, of each edge of the frame of the specified window. This size includes the title bar, if the window has one. The size of the frame may vary depending on the window-related hints used to create it.

Because this function retrieves the size of each window frame edge and not the offset along a particular coordinate axis, the retrieved values will always be zero or positive.

Any or all of the size arguments may be NULL. If an error occurs, all non-NULL size arguments will be set to zero.

Parameters
[in]windowThe window whose frame size to query.
[out]leftWhere to store the size, in screen coordinates, of the left edge of the window frame, or NULL.
[out]topWhere to store the size, in screen coordinates, of the top edge of the window frame, or NULL.
[out]rightWhere to store the size, in screen coordinates, of the right edge of the window frame, or NULL.
[out]bottomWhere to store the size, in screen coordinates, of the bottom edge of the window frame, or NULL.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

This function must only be called from the main thread.

See also
window_size
Since
Added in version 3.1.

◆ glfwGetWindowMonitor()

GLFWAPI GLFWmonitor * glfwGetWindowMonitor ( GLFWwindow window)

Returns the monitor that the window uses for full screen mode.

This function returns the handle of the monitor that the specified window is in full screen on.

Parameters
[in]windowThe window to query.
Returns
The monitor, or NULL if the window is in windowed mode or an error occurred.

Possible errors include GLFW_NOT_INITIALIZED.

This function must only be called from the main thread.

See also
window_monitor
glfwSetWindowMonitor
Since
Added in version 3.0.

◆ glfwGetWindowOpacity()

GLFWAPI float glfwGetWindowOpacity ( GLFWwindow window)

Returns the opacity of the whole window.

This function returns the opacity of the window, including any decorations.

The opacity (or alpha) value is a positive finite number between zero and one, where zero is fully transparent and one is fully opaque. If the system does not support whole window transparency, this function always returns one.

The initial opacity value for newly created windows is one.

Parameters
[in]windowThe window to query.
Returns
The opacity value of the specified window.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

This function must only be called from the main thread.

See also
window_transparency
glfwSetWindowOpacity
Since
Added in version 3.3.

◆ glfwGetWindowPos()

GLFWAPI void glfwGetWindowPos ( GLFWwindow window,
int *  xpos,
int *  ypos 
)

Retrieves the position of the content area of the specified window.

This function retrieves the position, in screen coordinates, of the upper-left corner of the content area of the specified window.

Any or all of the position arguments may be NULL. If an error occurs, all non-NULL position arguments will be set to zero.

Parameters
[in]windowThe window to query.
[out]xposWhere to store the x-coordinate of the upper-left corner of the content area, or NULL.
[out]yposWhere to store the y-coordinate of the upper-left corner of the content area, or NULL.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks
There is no way for an application to retrieve the global position of its windows, this function will always emit GLFW_PLATFORM_ERROR.

This function must only be called from the main thread.

See also
window_pos
glfwSetWindowPos
Since
Added in version 3.0.

This function retrieves the position, in screen coordinates, of the upper-left corner of the content area of the specified window.

Any or all of the position arguments may be NULL. If an error occurs, all non-NULL position arguments will be set to zero.

Parameters
[in]windowThe window to query.
[out]xposWhere to store the x-coordinate of the upper-left corner of the content area, or NULL.
[out]yposWhere to store the y-coordinate of the upper-left corner of the content area, or NULL.

Possible errors include GLFW_NOT_INITIALIZED, GLFW_PLATFORM_ERROR and GLFW_FEATURE_UNAVAILABLE (see remarks).

Remarks
There is no way for an application to retrieve the global position of its windows. This function will emit GLFW_FEATURE_UNAVAILABLE.

This function must only be called from the main thread.

See also
window_pos
glfwSetWindowPos
Since
Added in version 3.0.

◆ glfwGetWindowSize()

GLFWAPI void glfwGetWindowSize ( GLFWwindow window,
int *  width,
int *  height 
)

Retrieves the size of the content area of the specified window.

This function retrieves the size, in screen coordinates, of the content area of the specified window. If you wish to retrieve the size of the framebuffer of the window in pixels, see glfwGetFramebufferSize.

Any or all of the size arguments may be NULL. If an error occurs, all non-NULL size arguments will be set to zero.

Parameters
[in]windowThe window whose size to retrieve.
[out]widthWhere to store the width, in screen coordinates, of the content area, or NULL.
[out]heightWhere to store the height, in screen coordinates, of the content area, or NULL.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

This function must only be called from the main thread.

See also
window_size
glfwSetWindowSize
Since
Added in version 1.0. Added window handle parameter.

◆ glfwGetWindowTitle()

GLFWAPI const char* glfwGetWindowTitle ( GLFWwindow window)

Returns the title of the specified window.

This function returns the window title, encoded as UTF-8, of the specified window. This is the title set previously by glfwCreateWindow or glfwSetWindowTitle.

Parameters
[in]windowThe window to query.
Returns
The UTF-8 encoded window title, or NULL if an error occurred.

Possible errors include GLFW_NOT_INITIALIZED.

Remarks
The returned title is currently a copy of the title last set by glfwCreateWindow or glfwSetWindowTitle. It does not include any additional text which may be appended by the platform or another program.

The returned string is allocated and freed by GLFW. You should not free it yourself. It is valid until the next call to glfwGetWindowTitle or glfwSetWindowTitle, or until the library is terminated.

This function must only be called from the main thread.

See also
window_title
glfwSetWindowTitle
Since
Added in version 3.4.

◆ glfwGetWindowUserPointer()

GLFWAPI void * glfwGetWindowUserPointer ( GLFWwindow window)

Returns the user pointer of the specified window.

This function returns the current value of the user-defined pointer of the specified window. The initial value is NULL.

Parameters
[in]windowThe window whose pointer to return.

Possible errors include GLFW_NOT_INITIALIZED.

This function may be called from any thread. Access is not synchronized.

See also
window_userptr
glfwSetWindowUserPointer
Since
Added in version 3.0.

◆ glfwHideWindow()

GLFWAPI void glfwHideWindow ( GLFWwindow window)

Hides the specified window.

This function hides the specified window if it was previously visible. If the window is already hidden or is in full screen mode, this function does nothing.

Parameters
[in]windowThe window to hide.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

This function must only be called from the main thread.

See also
window_hide
glfwShowWindow
Since
Added in version 3.0.

◆ glfwIconifyWindow()

GLFWAPI void glfwIconifyWindow ( GLFWwindow window)

Iconifies the specified window.

This function iconifies (minimizes) the specified window if it was previously restored. If the window is already iconified, this function does nothing.

If the specified window is a full screen window, GLFW restores the original video mode of the monitor. The window's desired video mode is set again when the window is restored.

Parameters
[in]windowThe window to iconify.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

This function must only be called from the main thread.

See also
window_iconify
glfwRestoreWindow
glfwMaximizeWindow
Since
Added in version 2.1. Added window handle parameter.

This function iconifies (minimizes) the specified window if it was previously restored. If the window is already iconified, this function does nothing.

If the specified window is a full screen window, GLFW restores the original video mode of the monitor. The window's desired video mode is set again when the window is restored.

Parameters
[in]windowThe window to iconify.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks
Once a window is iconified, glfwRestoreWindow won’t be able to restore it. This is a design decision of the xdg-shell protocol.

This function must only be called from the main thread.

See also
window_iconify
glfwRestoreWindow
glfwMaximizeWindow
Since
Added in version 2.1. Added window handle parameter.

◆ glfwMaximizeWindow()

GLFWAPI void glfwMaximizeWindow ( GLFWwindow window)

Maximizes the specified window.

This function maximizes the specified window if it was previously not maximized. If the window is already maximized, this function does nothing.

If the specified window is a full screen window, this function does nothing.

Parameters
[in]windowThe window to maximize.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Thread Safety
This function may only be called from the main thread.
See also
window_iconify
glfwIconifyWindow
glfwRestoreWindow
Since
Added in GLFW 3.2.

◆ glfwPollEvents()

GLFWAPI void glfwPollEvents ( void  )

Processes all pending events.

This function processes only those events that are already in the event queue and then returns immediately. Processing events will cause the window and input callbacks associated with those events to be called.

On some platforms, a window move, resize or menu operation will cause event processing to block. This is due to how event processing is designed on those platforms. You can use the window refresh callback to redraw the contents of your window when necessary during such operations.

Do not assume that callbacks you set will only be called in response to event processing functions like this one. While it is necessary to poll for events, window systems that require GLFW to register callbacks of its own can pass events to GLFW in response to many window system function calls. GLFW will pass those events on to the application callbacks before returning.

Event processing is not required for joystick input to work.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

This function must not be called from a callback.

This function must only be called from the main thread.

See also
events
glfwWaitEvents
glfwWaitEventsTimeout
Since
Added in version 1.0.

◆ glfwPostEmptyEvent()

GLFWAPI void glfwPostEmptyEvent ( void  )

Posts an empty event to the event queue.

This function posts an empty event from the current thread to the event queue, causing glfwWaitEvents or glfwWaitEventsTimeout to return.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

This function may be called from any thread.

See also
events
glfwWaitEvents
glfwWaitEventsTimeout
Since
Added in version 3.1.

◆ glfwRequestWindowAttention()

GLFWAPI void glfwRequestWindowAttention ( GLFWwindow window)

Requests user attention to the specified window.

This function requests user attention to the specified window. On platforms where this is not supported, attention is requested to the application as a whole.

Once the user has given attention, usually by focusing the window or application, the system will end the request automatically.

Parameters
[in]windowThe window to request attention to.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks
Attention is requested to the application as a whole, not the specific window.

This function must only be called from the main thread.

See also
window_attention
Since
Added in version 3.3.

◆ glfwRestoreWindow()

GLFWAPI void glfwRestoreWindow ( GLFWwindow window)

Restores the specified window.

This function restores the specified window if it was previously iconified (minimized) or maximized. If the window is already restored, this function does nothing.

If the specified window is an iconified full screen window, its desired video mode is set again for its monitor when the window is restored.

Parameters
[in]windowThe window to restore.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

This function must only be called from the main thread.

See also
window_iconify
glfwIconifyWindow
glfwMaximizeWindow
Since
Added in version 2.1. Added window handle parameter.

◆ glfwSetFramebufferSizeCallback()

GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback ( GLFWwindow window,
GLFWframebuffersizefun  callback 
)

Sets the framebuffer resize callback for the specified window.

This function sets the framebuffer resize callback of the specified window, which is called when the framebuffer of the specified window is resized.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
void function_name(GLFWwindow* window, int width, int height)

For more information about the callback parameters, see the function pointer type.

Possible errors include GLFW_NOT_INITIALIZED.

This function must only be called from the main thread.

See also
window_fbsize
Since
Added in version 3.0.

◆ glfwSetWindowAspectRatio()

GLFWAPI void glfwSetWindowAspectRatio ( GLFWwindow window,
int  numer,
int  denom 
)

Sets the aspect ratio of the specified window.

This function sets the required aspect ratio of the content area of the specified window. If the window is full screen, the aspect ratio only takes effect once it is made windowed. If the window is not resizable, this function does nothing.

The aspect ratio is specified as a numerator and a denominator and both values must be greater than zero. For example, the common 16:9 aspect ratio is specified as 16 and 9, respectively.

If the numerator and denominator is set to GLFW_DONT_CARE then the aspect ratio limit is disabled.

The aspect ratio is applied immediately to a windowed mode window and may cause it to be resized.

Parameters
[in]windowThe window to set limits for.
[in]numerThe numerator of the desired aspect ratio, or GLFW_DONT_CARE.
[in]denomThe denominator of the desired aspect ratio, or GLFW_DONT_CARE.

Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_VALUE and GLFW_PLATFORM_ERROR.

Remarks
If you set size limits and an aspect ratio that conflict, the results are undefined.
The aspect ratio will not be applied until the window is actually resized, either by the user or by the compositor.

This function must only be called from the main thread.

See also
window_sizelimits
glfwSetWindowSizeLimits
Since
Added in version 3.2.

◆ glfwSetWindowAttrib()

GLFWAPI void glfwSetWindowAttrib ( GLFWwindow window,
int  attrib,
int  value 
)

Sets an attribute of the specified window.

This function sets the value of an attribute of the specified window.

The supported attributes are GLFW_DECORATED, GLFW_RESIZABLE, GLFW_FLOATING, GLFW_AUTO_ICONIFY and GLFW_FOCUS_ON_SHOW.

Some of these attributes are ignored for full screen windows. The new value will take effect if the window is later made windowed.

Some of these attributes are ignored for windowed mode windows. The new value will take effect if the window is later made full screen.

Parameters
[in]windowThe window to set the attribute for.
[in]attribA supported window attribute.
[in]valueGLFW_TRUE or GLFW_FALSE.

Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM, GLFW_INVALID_VALUE and GLFW_PLATFORM_ERROR.

Remarks
Calling glfwGetWindowAttrib will always return the latest value, even if that value is ignored by the current mode of the window.

This function must only be called from the main thread.

See also
window_attribs
glfwGetWindowAttrib
Since
Added in version 3.3.

This function sets the value of an attribute of the specified window.

The supported attributes are GLFW_DECORATED, GLFW_RESIZABLE, GLFW_FLOATING, GLFW_AUTO_ICONIFY and GLFW_FOCUS_ON_SHOW. GLFW_MOUSE_PASSTHROUGH

Some of these attributes are ignored for full screen windows. The new value will take effect if the window is later made windowed.

Some of these attributes are ignored for windowed mode windows. The new value will take effect if the window is later made full screen.

Parameters
[in]windowThe window to set the attribute for.
[in]attribA supported window attribute.
[in]valueGLFW_TRUE or GLFW_FALSE.

Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_ENUM, GLFW_INVALID_VALUE, GLFW_PLATFORM_ERROR and GLFW_FEATURE_UNAVAILABLE (see remarks).

Remarks
Calling glfwGetWindowAttrib will always return the latest value, even if that value is ignored by the current mode of the window.
The GLFW_FLOATING window attribute is not supported. Setting this will emit GLFW_FEATURE_UNAVAILABLE.

This function must only be called from the main thread.

See also
window_attribs
glfwGetWindowAttrib
Since
Added in version 3.3.

◆ glfwSetWindowCloseCallback()

GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback ( GLFWwindow window,
GLFWwindowclosefun  callback 
)

Sets the close callback for the specified window.

This function sets the close callback of the specified window, which is called when the user attempts to close the window, for example by clicking the close widget in the title bar.

The close flag is set before this callback is called, but you can modify it at any time with glfwSetWindowShouldClose.

The close callback is not triggered by glfwDestroyWindow.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
void function_name(GLFWwindow* window)

For more information about the callback parameters, see the function pointer type.

Possible errors include GLFW_NOT_INITIALIZED.

Remarks
Selecting Quit from the application menu will trigger the close callback for all windows.

This function must only be called from the main thread.

See also
window_close
Since
Added in version 2.5. Added window handle parameter and return value.

◆ glfwSetWindowContentScaleCallback()

GLFWAPI GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback ( GLFWwindow window,
GLFWwindowcontentscalefun  callback 
)

Sets the window content scale callback for the specified window.

This function sets the window content scale callback of the specified window, which is called when the content scale of the specified window changes.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
void function_name(GLFWwindow* window, float xscale, float yscale)

For more information about the callback parameters, see the function pointer type.

Possible errors include GLFW_NOT_INITIALIZED.

This function must only be called from the main thread.

See also
window_scale
glfwGetWindowContentScale
Since
Added in version 3.3.

◆ glfwSetWindowFocusCallback()

GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback ( GLFWwindow window,
GLFWwindowfocusfun  callback 
)

Sets the focus callback for the specified window.

This function sets the focus callback of the specified window, which is called when the window gains or loses input focus.

After the focus callback is called for a window that lost input focus, synthetic key and mouse button release events will be generated for all such that had been pressed. For more information, see glfwSetKeyCallback and glfwSetMouseButtonCallback.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
void function_name(GLFWwindow* window, int focused)

For more information about the callback parameters, see the function pointer type.

Possible errors include GLFW_NOT_INITIALIZED.

This function must only be called from the main thread.

See also
window_focus
Since
Added in version 3.0.

◆ glfwSetWindowIcon()

GLFWAPI void glfwSetWindowIcon ( GLFWwindow window,
int  count,
const GLFWimage images 
)

Sets the icon for the specified window.

This function sets the icon of the specified window. If passed an array of candidate images, those of or closest to the sizes desired by the system are selected. If no images are specified, the window reverts to its default icon.

The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel with the red channel first. They are arranged canonically as packed sequential rows, starting from the top-left corner.

The desired image sizes varies depending on platform and system settings. The selected images will be rescaled as needed. Good sizes include 16x16, 32x32 and 48x48.

Parameters
[in]windowThe window whose icon to set.
[in]countThe number of images in the specified array, or zero to revert to the default window icon.
[in]imagesThe images to create the icon from. This is ignored if count is zero.

Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_VALUE and GLFW_PLATFORM_ERROR.

The specified image data is copied before this function returns.

Remarks
The GLFW window has no icon, as it is not a document window, so this function does nothing. The dock icon will be the same as the application bundle's icon. For more information on bundles, see the Bundle Programming Guide in the Mac Developer Library.
There is no existing protocol to change an icon, the window will thus inherit the one defined in the application's desktop file. This function always emits GLFW_PLATFORM_ERROR.

This function must only be called from the main thread.

See also
window_icon
Since
Added in version 3.2.

This function sets the icon of the specified window. If passed an array of candidate images, those of or closest to the sizes desired by the system are selected. If no images are specified, the window reverts to its default icon.

The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel with the red channel first. They are arranged canonically as packed sequential rows, starting from the top-left corner.

The desired image sizes varies depending on platform and system settings. The selected images will be rescaled as needed. Good sizes include 16x16, 32x32 and 48x48.

Parameters
[in]windowThe window whose icon to set.
[in]countThe number of images in the specified array, or zero to revert to the default window icon.
[in]imagesThe images to create the icon from. This is ignored if count is zero.

Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_VALUE, GLFW_PLATFORM_ERROR and GLFW_FEATURE_UNAVAILABLE (see remarks).

The specified image data is copied before this function returns.

Remarks
Regular windows do not have icons on macOS. This function will emit GLFW_FEATURE_UNAVAILABLE. The dock icon will be the same as the application bundle's icon. For more information on bundles, see the Bundle Programming Guide in the Mac Developer Library.
There is no existing protocol to change an icon, the window will thus inherit the one defined in the application's desktop file. This function will emit GLFW_FEATURE_UNAVAILABLE.

This function must only be called from the main thread.

See also
window_icon
Since
Added in version 3.2.

◆ glfwSetWindowIconifyCallback()

GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback ( GLFWwindow window,
GLFWwindowiconifyfun  callback 
)

Sets the iconify callback for the specified window.

This function sets the iconification callback of the specified window, which is called when the window is iconified or restored.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
void function_name(GLFWwindow* window, int iconified)

For more information about the callback parameters, see the function pointer type.

Possible errors include GLFW_NOT_INITIALIZED.

Remarks
The XDG-shell protocol has no event for iconification, so this callback will never be called.

This function must only be called from the main thread.

See also
window_iconify
Since
Added in version 3.0.

This function sets the iconification callback of the specified window, which is called when the window is iconified or restored.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
void function_name(GLFWwindow* window, int iconified)

For more information about the callback parameters, see the function pointer type.

Possible errors include GLFW_NOT_INITIALIZED.

This function must only be called from the main thread.

See also
window_iconify
Since
Added in version 3.0.

◆ glfwSetWindowMaximizeCallback()

GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback ( GLFWwindow window,
GLFWwindowmaximizefun  callback 
)

Sets the maximize callback for the specified window.

This function sets the maximization callback of the specified window, which is called when the window is maximized or restored.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
void function_name(GLFWwindow* window, int maximized)

For more information about the callback parameters, see the function pointer type.

Possible errors include GLFW_NOT_INITIALIZED.

This function must only be called from the main thread.

See also
window_maximize
Since
Added in version 3.3.

◆ glfwSetWindowMonitor()

GLFWAPI void glfwSetWindowMonitor ( GLFWwindow window,
GLFWmonitor monitor,
int  xpos,
int  ypos,
int  width,
int  height,
int  refreshRate 
)

Sets the mode, monitor, video mode and placement of a window.

This function sets the monitor that the window uses for full screen mode or, if the monitor is NULL, makes it windowed mode.

When setting a monitor, this function updates the width, height and refresh rate of the desired video mode and switches to the video mode closest to it. The window position is ignored when setting a monitor.

When the monitor is NULL, the position, width and height are used to place the window content area. The refresh rate is ignored when no monitor is specified.

If you only wish to update the resolution of a full screen window or the size of a windowed mode window, see glfwSetWindowSize.

When a window transitions from full screen to windowed mode, this function restores any previous window settings such as whether it is decorated, floating, resizable, has size or aspect ratio limits, etc.

Parameters
[in]windowThe window whose monitor, size or video mode to set.
[in]monitorThe desired monitor, or NULL to set windowed mode.
[in]xposThe desired x-coordinate of the upper-left corner of the content area.
[in]yposThe desired y-coordinate of the upper-left corner of the content area.
[in]widthThe desired with, in screen coordinates, of the content area or video mode.
[in]heightThe desired height, in screen coordinates, of the content area or video mode.
[in]refreshRateThe desired refresh rate, in Hz, of the video mode, or GLFW_DONT_CARE.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks
The OpenGL or OpenGL ES context will not be destroyed or otherwise affected by any resizing or mode switching, although you may need to update your viewport if the framebuffer size has changed.
The desired window position is ignored, as there is no way for an application to set this property.
Setting the window to full screen will not attempt to change the mode, no matter what the requested size or refresh rate.

This function must only be called from the main thread.

See also
window_monitor
window_full_screen
glfwGetWindowMonitor
glfwSetWindowSize
Since
Added in version 3.2.

This function sets the monitor that the window uses for full screen mode or, if the monitor is NULL, makes it windowed mode.

When setting a monitor, this function updates the width, height and refresh rate of the desired video mode and switches to the video mode closest to it. The window position is ignored when setting a monitor.

When the monitor is NULL, the position, width and height are used to place the window content area. The refresh rate is ignored when no monitor is specified.

If you only wish to update the resolution of a full screen window or the size of a windowed mode window, see glfwSetWindowSize.

When a window transitions from full screen to windowed mode, this function restores any previous window settings such as whether it is decorated, floating, resizable, has size or aspect ratio limits, etc.

Parameters
[in]windowThe window whose monitor, size or video mode to set.
[in]monitorThe desired monitor, or NULL to set windowed mode.
[in]xposThe desired x-coordinate of the upper-left corner of the content area.
[in]yposThe desired y-coordinate of the upper-left corner of the content area.
[in]widthThe desired with, in screen coordinates, of the content area or video mode.
[in]heightThe desired height, in screen coordinates, of the content area or video mode.
[in]refreshRateThe desired refresh rate, in Hz, of the video mode, or GLFW_DONT_CARE.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks
The OpenGL or OpenGL ES context will not be destroyed or otherwise affected by any resizing or mode switching, although you may need to update your viewport if the framebuffer size has changed.
The desired window position is ignored, as there is no way for an application to set this property.

This function must only be called from the main thread.

See also
window_monitor
window_full_screen
glfwGetWindowMonitor
glfwSetWindowSize
Since
Added in version 3.2.

◆ glfwSetWindowOpacity()

GLFWAPI void glfwSetWindowOpacity ( GLFWwindow window,
float  opacity 
)

Sets the opacity of the whole window.

This function sets the opacity of the window, including any decorations.

The opacity (or alpha) value is a positive finite number between zero and one, where zero is fully transparent and one is fully opaque.

The initial opacity value for newly created windows is one.

A window created with framebuffer transparency may not use whole window transparency. The results of doing this are undefined.

Parameters
[in]windowThe window to set the opacity for.
[in]opacityThe desired opacity of the specified window.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

This function must only be called from the main thread.

See also
window_transparency
glfwGetWindowOpacity
Since
Added in version 3.3.

This function sets the opacity of the window, including any decorations.

The opacity (or alpha) value is a positive finite number between zero and one, where zero is fully transparent and one is fully opaque.

The initial opacity value for newly created windows is one.

A window created with framebuffer transparency may not use whole window transparency. The results of doing this are undefined.

Parameters
[in]windowThe window to set the opacity for.
[in]opacityThe desired opacity of the specified window.

Possible errors include GLFW_NOT_INITIALIZED, GLFW_PLATFORM_ERROR and GLFW_FEATURE_UNAVAILABLE (see remarks).

Remarks
There is no way to set an opacity factor for a window. This function will emit GLFW_FEATURE_UNAVAILABLE.

This function must only be called from the main thread.

See also
window_transparency
glfwGetWindowOpacity
Since
Added in version 3.3.

◆ glfwSetWindowPos()

GLFWAPI void glfwSetWindowPos ( GLFWwindow window,
int  xpos,
int  ypos 
)

Sets the position of the content area of the specified window.

This function sets the position, in screen coordinates, of the upper-left corner of the content area of the specified windowed mode window. If the window is a full screen window, this function does nothing.

Do not use this function to move an already visible window unless you have very good reasons for doing so, as it will confuse and annoy the user.

The window manager may put limits on what positions are allowed. GLFW cannot and should not override these limits.

Parameters
[in]windowThe window to query.
[in]xposThe x-coordinate of the upper-left corner of the content area.
[in]yposThe y-coordinate of the upper-left corner of the content area.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks
There is no way for an application to set the global position of its windows, this function will always emit GLFW_PLATFORM_ERROR.

This function must only be called from the main thread.

See also
window_pos
glfwGetWindowPos
Since
Added in version 1.0. Added window handle parameter.

This function sets the position, in screen coordinates, of the upper-left corner of the content area of the specified windowed mode window. If the window is a full screen window, this function does nothing.

Do not use this function to move an already visible window unless you have very good reasons for doing so, as it will confuse and annoy the user.

The window manager may put limits on what positions are allowed. GLFW cannot and should not override these limits.

Parameters
[in]windowThe window to query.
[in]xposThe x-coordinate of the upper-left corner of the content area.
[in]yposThe y-coordinate of the upper-left corner of the content area.

Possible errors include GLFW_NOT_INITIALIZED, GLFW_PLATFORM_ERROR and GLFW_FEATURE_UNAVAILABLE (see remarks).

Remarks
There is no way for an application to set the global position of its windows. This function will emit GLFW_FEATURE_UNAVAILABLE.

This function must only be called from the main thread.

See also
window_pos
glfwGetWindowPos
Since
Added in version 1.0. Added window handle parameter.

◆ glfwSetWindowPosCallback()

GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback ( GLFWwindow window,
GLFWwindowposfun  callback 
)

Sets the position callback for the specified window.

This function sets the position callback of the specified window, which is called when the window is moved. The callback is provided with the position, in screen coordinates, of the upper-left corner of the content area of the window.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
void function_name(GLFWwindow* window, int xpos, int ypos)

For more information about the callback parameters, see the function pointer type.

Possible errors include GLFW_NOT_INITIALIZED.

Remarks
This callback will never be called, as there is no way for an application to know its global position.

This function must only be called from the main thread.

See also
window_pos
Since
Added in version 3.0.

◆ glfwSetWindowRefreshCallback()

GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback ( GLFWwindow window,
GLFWwindowrefreshfun  callback 
)

Sets the refresh callback for the specified window.

This function sets the refresh callback of the specified window, which is called when the content area of the window needs to be redrawn, for example if the window has been exposed after having been covered by another window.

On compositing window systems such as Aero, Compiz, Aqua or Wayland, where the window contents are saved off-screen, this callback may be called only very infrequently or never at all.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
void function_name(GLFWwindow* window);

For more information about the callback parameters, see the function pointer type.

Possible errors include GLFW_NOT_INITIALIZED.

This function must only be called from the main thread.

See also
window_refresh
Since
Added in version 2.5. Added window handle parameter and return value.

◆ glfwSetWindowShouldClose()

GLFWAPI void glfwSetWindowShouldClose ( GLFWwindow window,
int  value 
)

Sets the close flag of the specified window.

This function sets the value of the close flag of the specified window. This can be used to override the user's attempt to close the window, or to signal that it should be closed.

Parameters
[in]windowThe window whose flag to change.
[in]valueThe new value.

Possible errors include GLFW_NOT_INITIALIZED.

This function may be called from any thread. Access is not synchronized.

See also
window_close
Since
Added in version 3.0.

◆ glfwSetWindowSize()

GLFWAPI void glfwSetWindowSize ( GLFWwindow window,
int  width,
int  height 
)

Sets the size of the content area of the specified window.

This function sets the size, in screen coordinates, of the content area of the specified window.

For full screen windows, this function updates the resolution of its desired video mode and switches to the video mode closest to it, without affecting the window's context. As the context is unaffected, the bit depths of the framebuffer remain unchanged.

If you wish to update the refresh rate of the desired video mode in addition to its resolution, see glfwSetWindowMonitor.

The window manager may put limits on what sizes are allowed. GLFW cannot and should not override these limits.

Parameters
[in]windowThe window to resize.
[in]widthThe desired width, in screen coordinates, of the window content area.
[in]heightThe desired height, in screen coordinates, of the window content area.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks
A full screen window will not attempt to change the mode, no matter what the requested size.

This function must only be called from the main thread.

See also
window_size
glfwGetWindowSize
glfwSetWindowMonitor
Since
Added in version 1.0. Added window handle parameter.

This function sets the size, in screen coordinates, of the content area of the specified window.

For full screen windows, this function updates the resolution of its desired video mode and switches to the video mode closest to it, without affecting the window's context. As the context is unaffected, the bit depths of the framebuffer remain unchanged.

If you wish to update the refresh rate of the desired video mode in addition to its resolution, see glfwSetWindowMonitor.

The window manager may put limits on what sizes are allowed. GLFW cannot and should not override these limits.

Parameters
[in]windowThe window to resize.
[in]widthThe desired width, in screen coordinates, of the window content area.
[in]heightThe desired height, in screen coordinates, of the window content area.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

This function must only be called from the main thread.

See also
window_size
glfwGetWindowSize
glfwSetWindowMonitor
Since
Added in version 1.0. Added window handle parameter.

◆ glfwSetWindowSizeCallback()

GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback ( GLFWwindow window,
GLFWwindowsizefun  callback 
)

Sets the size callback for the specified window.

This function sets the size callback of the specified window, which is called when the window is resized. The callback is provided with the size, in screen coordinates, of the content area of the window.

Parameters
[in]windowThe window whose callback to set.
[in]callbackThe new callback, or NULL to remove the currently set callback.
Returns
The previously set callback, or NULL if no callback was set or the library had not been initialized.
void function_name(GLFWwindow* window, int width, int height)

For more information about the callback parameters, see the function pointer type.

Possible errors include GLFW_NOT_INITIALIZED.

This function must only be called from the main thread.

See also
window_size
Since
Added in version 1.0. Added window handle parameter and return value.

◆ glfwSetWindowSizeLimits()

GLFWAPI void glfwSetWindowSizeLimits ( GLFWwindow window,
int  minwidth,
int  minheight,
int  maxwidth,
int  maxheight 
)

Sets the size limits of the specified window.

This function sets the size limits of the content area of the specified window. If the window is full screen, the size limits only take effect once it is made windowed. If the window is not resizable, this function does nothing.

The size limits are applied immediately to a windowed mode window and may cause it to be resized.

The maximum dimensions must be greater than or equal to the minimum dimensions and all must be greater than or equal to zero.

Parameters
[in]windowThe window to set limits for.
[in]minwidthThe minimum width, in screen coordinates, of the content area, or GLFW_DONT_CARE.
[in]minheightThe minimum height, in screen coordinates, of the content area, or GLFW_DONT_CARE.
[in]maxwidthThe maximum width, in screen coordinates, of the content area, or GLFW_DONT_CARE.
[in]maxheightThe maximum height, in screen coordinates, of the content area, or GLFW_DONT_CARE.

Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_VALUE and GLFW_PLATFORM_ERROR.

Remarks
If you set size limits and an aspect ratio that conflict, the results are undefined.
The size limits will not be applied until the window is actually resized, either by the user or by the compositor.

This function must only be called from the main thread.

See also
window_sizelimits
glfwSetWindowAspectRatio
Since
Added in version 3.2.

◆ glfwSetWindowTitle()

GLFWAPI void glfwSetWindowTitle ( GLFWwindow window,
const char *  title 
)

Sets the title of the specified window.

This function sets the window title, encoded as UTF-8, of the specified window.

Parameters
[in]windowThe window whose title to change.
[in]titleThe UTF-8 encoded window title.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks
The window title will not be updated until the next time you process events.

This function must only be called from the main thread.

See also
window_title
Since
Added in version 1.0. Added window handle parameter.

This function sets the window title, encoded as UTF-8, of the specified window.

Parameters
[in]windowThe window whose title to change.
[in]titleThe UTF-8 encoded window title.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks
The window title will not be updated until the next time you process events.

This function must only be called from the main thread.

See also
window_title
glfwGetWindowTitle
Since
Added in version 1.0. Added window handle parameter.

◆ glfwSetWindowUserPointer()

GLFWAPI void glfwSetWindowUserPointer ( GLFWwindow window,
void *  pointer 
)

Sets the user pointer of the specified window.

This function sets the user-defined pointer of the specified window. The current value is retained until the window is destroyed. The initial value is NULL.

Parameters
[in]windowThe window whose pointer to set.
[in]pointerThe new value.

Possible errors include GLFW_NOT_INITIALIZED.

This function may be called from any thread. Access is not synchronized.

See also
window_userptr
glfwGetWindowUserPointer
Since
Added in version 3.0.

◆ glfwShowWindow()

GLFWAPI void glfwShowWindow ( GLFWwindow window)

Makes the specified window visible.

This function makes the specified window visible if it was previously hidden. If the window is already visible or is in full screen mode, this function does nothing.

By default, windowed mode windows are focused when shown Set the GLFW_FOCUS_ON_SHOW window hint to change this behavior for all newly created windows, or change the behavior for an existing window with glfwSetWindowAttrib.

Parameters
[in]windowThe window to make visible.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

Remarks
Because Wayland wants every frame of the desktop to be complete, this function does not immediately make the window visible. Instead it will become visible the next time the window framebuffer is updated after this call.

This function must only be called from the main thread.

See also
window_hide
glfwHideWindow
Since
Added in version 3.0.

◆ glfwSwapBuffers()

GLFWAPI void glfwSwapBuffers ( GLFWwindow window)

Swaps the front and back buffers of the specified window.

This function swaps the front and back buffers of the specified window when rendering with OpenGL or OpenGL ES. If the swap interval is greater than zero, the GPU driver waits the specified number of screen updates before swapping the buffers.

The specified window must have an OpenGL or OpenGL ES context. Specifying a window without a context will generate a GLFW_NO_WINDOW_CONTEXT error.

This function does not apply to Vulkan. If you are rendering with Vulkan, see vkQueuePresentKHR instead.

Parameters
[in]windowThe window whose buffers to swap.

Possible errors include GLFW_NOT_INITIALIZED, GLFW_NO_WINDOW_CONTEXT and GLFW_PLATFORM_ERROR.

Remarks
EGL: The context of the specified window must be current on the calling thread.

This function may be called from any thread.

See also
buffer_swap
glfwSwapInterval
Since
Added in version 1.0. Added window handle parameter.

◆ glfwWaitEvents()

GLFWAPI void glfwWaitEvents ( void  )

Waits until events are queued and processes them.

This function puts the calling thread to sleep until at least one event is available in the event queue. Once one or more events are available, it behaves exactly like glfwPollEvents, i.e. the events in the queue are processed and the function then returns immediately. Processing events will cause the window and input callbacks associated with those events to be called.

Since not all events are associated with callbacks, this function may return without a callback having been called even if you are monitoring all callbacks.

On some platforms, a window move, resize or menu operation will cause event processing to block. This is due to how event processing is designed on those platforms. You can use the window refresh callback to redraw the contents of your window when necessary during such operations.

Do not assume that callbacks you set will only be called in response to event processing functions like this one. While it is necessary to poll for events, window systems that require GLFW to register callbacks of its own can pass events to GLFW in response to many window system function calls. GLFW will pass those events on to the application callbacks before returning.

Event processing is not required for joystick input to work.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_PLATFORM_ERROR.

This function must not be called from a callback.

This function must only be called from the main thread.

See also
events
glfwPollEvents
glfwWaitEventsTimeout
Since
Added in version 2.5.

◆ glfwWaitEventsTimeout()

GLFWAPI void glfwWaitEventsTimeout ( double  timeout)

Waits with timeout until events are queued and processes them.

This function puts the calling thread to sleep until at least one event is available in the event queue, or until the specified timeout is reached. If one or more events are available, it behaves exactly like glfwPollEvents, i.e. the events in the queue are processed and the function then returns immediately. Processing events will cause the window and input callbacks associated with those events to be called.

The timeout value must be a positive finite number.

Since not all events are associated with callbacks, this function may return without a callback having been called even if you are monitoring all callbacks.

On some platforms, a window move, resize or menu operation will cause event processing to block. This is due to how event processing is designed on those platforms. You can use the window refresh callback to redraw the contents of your window when necessary during such operations.

Do not assume that callbacks you set will only be called in response to event processing functions like this one. While it is necessary to poll for events, window systems that require GLFW to register callbacks of its own can pass events to GLFW in response to many window system function calls. GLFW will pass those events on to the application callbacks before returning.

Event processing is not required for joystick input to work.

Parameters
[in]timeoutThe maximum amount of time, in seconds, to wait.

Possible errors include GLFW_NOT_INITIALIZED, GLFW_INVALID_VALUE and GLFW_PLATFORM_ERROR.

This function must not be called from a callback.

This function must only be called from the main thread.

See also
events
glfwPollEvents
glfwWaitEvents
Since
Added in version 3.2.

◆ glfwWindowHint()

GLFWAPI void glfwWindowHint ( int  hint,
int  value 
)

Sets the specified window hint to the desired value.

This function sets hints for the next call to glfwCreateWindow. The hints, once set, retain their values until changed by a call to this function or glfwDefaultWindowHints, or until the library is terminated.

Only integer value hints can be set with this function. String value hints are set with glfwWindowHintString.

This function does not check whether the specified hint values are valid. If you set hints to invalid values this will instead be reported by the next call to glfwCreateWindow.

Some hints are platform specific. These may be set on any platform but they will only affect their specific platform. Other platforms will ignore them. Setting these hints requires no platform specific headers or functions.

Parameters
[in]hintThe window hint to set.
[in]valueThe new value of the window hint.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_INVALID_ENUM.

This function must only be called from the main thread.

See also
window_hints
glfwWindowHintString
glfwDefaultWindowHints
Since
Added in version 3.0. Replaces glfwOpenWindowHint.

◆ glfwWindowHintString()

GLFWAPI void glfwWindowHintString ( int  hint,
const char *  value 
)

Sets the specified window hint to the desired value.

This function sets hints for the next call to glfwCreateWindow. The hints, once set, retain their values until changed by a call to this function or glfwDefaultWindowHints, or until the library is terminated.

Only string type hints can be set with this function. Integer value hints are set with glfwWindowHint.

This function does not check whether the specified hint values are valid. If you set hints to invalid values this will instead be reported by the next call to glfwCreateWindow.

Some hints are platform specific. These may be set on any platform but they will only affect their specific platform. Other platforms will ignore them. Setting these hints requires no platform specific headers or functions.

Parameters
[in]hintThe window hint to set.
[in]valueThe new value of the window hint.

Possible errors include GLFW_NOT_INITIALIZED and GLFW_INVALID_ENUM.

The specified string is copied before this function returns.

This function must only be called from the main thread.

See also
window_hints
glfwWindowHint
glfwDefaultWindowHints
Since
Added in version 3.3.

◆ glfwWindowShouldClose()

GLFWAPI int glfwWindowShouldClose ( GLFWwindow window)

Checks the close flag of the specified window.

This function returns the value of the close flag of the specified window.

Parameters
[in]windowThe window to query.
Returns
The value of the close flag.

Possible errors include GLFW_NOT_INITIALIZED.

This function may be called from any thread. Access is not synchronized.

See also
window_close
Since
Added in version 3.0.