GLFW
relies on preview features of the Java platform:
GLFW
refers to one or more preview APIs:MemorySegment
,SegmentAllocator
.
- Since:
- 0.1.0
- Author:
- squid233
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Framebuffer related hintsstatic final int
Framebuffer related hintsstatic final int
Framebuffer related hintsstatic final int
Framebuffer related hintsstatic final int
Framebuffer related hintsstatic final int
static final int
GLFW could not find support for the requested API on the system.static final int
The regular arrow cursor.static final int
Window related hintsstatic final int
Framebuffer related hintsstatic final int
Framebuffer related hintsstatic final int
Window related hintsstatic final int
Context related hintsstatic final int
macOS specific init hintsstatic final int
macOS specific window hintsstatic final int
macOS specific window hintsstatic final int
macOS specific init hintsstatic final int
macOS specific window hintsstatic final int
static final int
Context related hintsstatic final int
Context related hintsstatic final int
Context related hintsstatic final int
CONTEXT_VERSION_MAJOR
,CONTEXT_VERSION_MINOR
andCONTEXT_REVISION
indicate the client API version of the window's context.static final int
Context related hintsstatic final int
Context related hintsstatic final int
Context related hintsstatic final int
The crosshair shape.static final int
static final int
Cursor modestatic final int
Cursor modestatic final int
Cursor modestatic final int
Window related hintsstatic final int
Framebuffer related hintsstatic final int
static final int
Don't care value.static final int
Framebuffer related hintsstatic final int
static final int
Zero.static final int
Window related hintsstatic final int
Window related hintsstatic final int
Window related hintsstatic final int
The requested format is not supported or available.static final int
Gamepad axes.static final int
Gamepad axes.static final int
Gamepad axes.static final int
Gamepad axes.static final int
Gamepad axes.static final int
Gamepad axes.static final int
Gamepad axes.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Gamepad buttons.static final int
Framebuffer related hintsstatic final int
The hand shape.static final int
Joystick hat states.static final int
Joystick hat states.static final int
Joystick hat states.static final int
Joystick hat states.static final int
Joystick hat states.static final int
Joystick hat states.static final int
Joystick hat states.static final int
Joystick hat states.static final int
Joystick hat states.static final int
HOVERED indicates whether the cursor is currently directly over the content area of the window, with no other windows between.static final int
The horizontal resize arrow shape.static final int
The text input I-beam cursor shape.static final int
Window related hintsstatic final int
One of the arguments to the function was an invalid enum value, for example requestingRED_BITS
withgetWindowAttrib(java.lang.foreign.MemorySegment, int)
PREVIEW.static final int
One of the arguments to the function was an invalid value, for example requesting a non-existent OpenGL or OpenGL ES version like 2.7.static final int
Joystick IDs.static final int
Joystick IDs.static final int
Joystick IDs.static final int
Joystick IDs.static final int
Joystick IDs.static final int
Joystick IDs.static final int
Joystick IDs.static final int
Joystick IDs.static final int
Joystick IDs.static final int
Joystick IDs.static final int
Joystick IDs.static final int
Joystick IDs.static final int
Joystick IDs.static final int
Joystick IDs.static final int
Joystick IDs.static final int
Joystick IDs.static final int
JOYSTICK_HAT_BUTTONS
specifies whether to also expose joystick hats as buttons, for compatibility with earlier versions of GLFW that did not havegetJoystickHats(int)
.static final int
Joystick IDs.static final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Function keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Function keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Printable keysstatic final int
static final int
Function keysstatic final int
Function keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Function keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Function keysstatic final int
Function keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Function keysstatic final int
Printable keysstatic final int
The unknown keystatic final int
Function keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
Printable keysstatic final int
static final int
value for CONTEXT_ROBUSTNESSstatic final int
Window related hintsstatic final int
If this bit is set one or more Alt keys were held down.static final int
If this bit is set the Caps Lock key is enabled and theLOCK_KEY_MODS
input mode is set.static final int
If this bit is set one or more Control keys were held down.static final int
If this bit is set the Num Lock key is enabled and theLOCK_KEY_MODS
input mode is set.static final int
If this bit is set one or more Shift keys were held down.static final int
If this bit is set one or more Super keys were held down.static final int
Mouse button IDs.static final int
Mouse button IDs.static final int
Mouse button IDs.static final int
Mouse button IDs.static final int
Mouse button IDs.static final int
Mouse button IDs.static final int
Mouse button IDs.static final int
Mouse button IDs.static final int
Mouse button IDs.static final int
Mouse button IDs.static final int
Mouse button IDs.static final int
Mouse button IDs.static final int
static final int
value for CLIENT_APIstatic final int
No context is current for this thread.static final int
No error has occurred.static final int
value for CONTEXT_ROBUSTNESSstatic final int
value for CONTEXT_ROBUSTNESSstatic final int
The specified window does not have an OpenGL or OpenGL ES context.static final int
GLFW has not been initialized.static final int
value for OPENGL_PROFILEstatic final int
value for CLIENT_APIstatic final int
value for OPENGL_PROFILEstatic final int
value for OPENGL_PROFILEstatic final int
Context related hintsstatic final int
value for CLIENT_APIstatic final int
Context related hintsstatic final int
Context related hintsstatic final int
static final int
A memory allocation failed.static final int
A platform-specific error occurred that does not match any of the more specific categories.static final int
The key or mouse button was pressed.static final int
static final int
Framebuffer related hintsstatic final int
REFRESH_RATE specifies the desired refresh rate for full screen windows.static final int
The key or mouse button was released.static final int
static final int
static final int
The key was held down until it repeated.static final int
Window related hintsstatic final int
Framebuffer related hintsstatic final int
Window related hintsstatic final int
Framebuffer related hintsstatic final int
Framebuffer related hintsstatic final int
Framebuffer related hintsstatic final int
static final int
static final int
Window related hintsstatic final int
One.static final int
The major version number of the GLFW header.static final int
The minor version number of the GLFW header.static final int
The revision number of the GLFW header.static final int
The requested OpenGL or OpenGL ES version (including any requested context or framebuffer hints) is not available on this machine.static final int
Window related hintsstatic final int
The vertical resize arrow shape.static final int
X11 specific window hintsstatic final int
X11 specific window hints -
Method Summary
Modifier and TypeMethodDescriptionstatic MemorySegmentPREVIEW
createCursor
(GLFWImage image, int xhot, int yhot) Creates a custom cursor.static MemorySegmentPREVIEW
createStandardCursor
(int shape) Creates a cursor with a standard shape.static MemorySegmentPREVIEW
createWindow
(int width, int height, String title, MemorySegmentPREVIEW monitor, MemorySegmentPREVIEW share) Creates a window and its associated context.static void
Resets all window hints to their default values.static void
destroyCursor
(MemorySegmentPREVIEW cursor) Destroys a cursor.static void
destroyWindow
(MemorySegmentPREVIEW window) Destroys the specified window and its context.static boolean
extensionSupported
(String extension) Returns whether the specified extension is available.static void
focusWindow
(MemorySegmentPREVIEW window) Brings the specified window to front and sets input focus.static @Nullable String
Returns the contents of the clipboard as a string.static MemorySegmentPREVIEW
Returns the window whose context is current on the calling thread.static Pair.OfDouble
getCursorPos
(MemorySegmentPREVIEW window) Retrieves the position of the cursor relative to the content area of the window.static void
getCursorPos
(MemorySegmentPREVIEW window, double @Nullable [] xpos, double @Nullable [] ypos) Retrieves the position of the cursor relative to the content area of the window.static Tuple2.OfObjInt
<String> getError()
Returns and clears the last error for the calling thread.static int
Returns and clears the last error for the calling thread.static String
getErrorString
(int errorCode) Converts the given error code to a readable string.static Pair.OfInt
Retrieves the size of the framebuffer of the specified window.static void
getFramebufferSize
(MemorySegmentPREVIEW window, int @Nullable [] width, int @Nullable [] height) Retrieves the size of the framebuffer of the specified window.static @Nullable String
getGamepadName
(int jid) Returns the human-readable gamepad name for the specified joystick.static boolean
getGamepadState
(int jid, GLFWGamepadState state) Retrieves the state of the specified joystick remapped as a gamepad.static @Nullable GLFWGammaRamp
getGammaRamp
(MemorySegmentPREVIEW monitor) Returns the current gamma ramp for the specified monitor.static int
getInputMode
(MemorySegmentPREVIEW window, int mode) Returns the value of an input option for the specified window.static float @Nullable []
getJoystickAxes
(int jid) Returns the values of all axes of the specified joystick.static boolean @Nullable []
getJoystickButtons
(int jid) Returns the state of all buttons of the specified joystick.static @Nullable String
getJoystickGUID
(int jid) Returns the SDL compatible GUID of the specified joystick.static byte[]
getJoystickHats
(int jid) Returns the state of all hats of the specified joystick.static @Nullable String
getJoystickName
(int jid) Returns the name of the specified joystick.static MemorySegmentPREVIEW
getJoystickUserPointer
(int jid) Returns the user pointer of the specified joystick.static int
getKey
(MemorySegmentPREVIEW window, int key) Returns the last reported state of a keyboard key for the specified window.static @Nullable String
getKeyName
(int key, int scancode) Returns the layout-specific name of the specified printable key.static int
getKeyScancode
(int key) Returns the platform-specific scancode of the specified key.static Pair.OfFloat
Retrieves the content scale for the specified monitor.static void
getMonitorContentScale
(MemorySegmentPREVIEW monitor, float @Nullable [] xscale, float @Nullable [] yscale) Retrieves the content scale for the specified monitor.static @Nullable String
getMonitorName
(MemorySegmentPREVIEW monitor) Returns the name of the specified monitor.static Pair.OfInt
Returns the physical size of the monitor.static void
getMonitorPhysicalSize
(MemorySegmentPREVIEW monitor, int @Nullable [] widthMM, int @Nullable [] heightMM) Returns the physical size of the monitor.static Pair.OfInt
getMonitorPos
(MemorySegmentPREVIEW monitor) Returns the position of the monitor's viewport on the virtual screen.static void
getMonitorPos
(MemorySegmentPREVIEW monitor, int @Nullable [] xpos, int @Nullable [] ypos) Returns the position of the monitor's viewport on the virtual screen.static MemorySegmentPREVIEW @Nullable []
Returns the currently connected monitors.static MemorySegmentPREVIEW
Returns the user pointer of the specified monitor.static Quad.OfInt
getMonitorWorkarea
(MemorySegmentPREVIEW monitor) Retrieves the work area of the monitor.static void
getMonitorWorkarea
(MemorySegmentPREVIEW monitor, int @Nullable [] xpos, int @Nullable [] ypos, int @Nullable [] width, int @Nullable [] height) Retrieves the work area of the monitor.static int
getMouseButton
(MemorySegmentPREVIEW window, int button) Returns the last reported state of a mouse button for the specified window.static MemorySegmentPREVIEW
Returns the primary monitor.static MemorySegmentPREVIEW
getProcAddress
(String procName) Returns the address of the specified function for the current context.static String @Nullable []
Returns the Vulkan instance extensions required by GLFW.static double
getTime()
Returns the GLFW time.static long
Returns the frequency, in Hz, of the raw timer.static long
Returns the current value of the raw timer.static Triplet.OfInt
Retrieves the version of the GLFW library.static void
getVersion
(int @Nullable [] major, int @Nullable [] minor, int @Nullable [] rev) Retrieves the version of the GLFW library.static String
Returns a string describing the compile-time configuration.static GLFWVidMode.Value
getVideoMode
(MemorySegmentPREVIEW monitor) Returns the current mode of the specified monitor.static GLFWVidMode.Buffer
getVideoModes
(SegmentAllocatorPREVIEW allocator, MemorySegmentPREVIEW monitor) Returns the available video modes for the specified monitor.static int
getWindowAttrib
(MemorySegmentPREVIEW window, int attrib) Returns an attribute of the specified window.static Pair.OfFloat
Retrieves the content scale for the specified window.static void
getWindowContentScale
(MemorySegmentPREVIEW window, float @Nullable [] xscale, float @Nullable [] yscale) Retrieves the content scale for the specified window.static Quad.OfInt
Retrieves the size of the frame of the window.static void
getWindowFrameSize
(MemorySegmentPREVIEW window, int @Nullable [] left, int @Nullable [] top, int @Nullable [] right, int @Nullable [] bottom) Retrieves the size of the frame of the window.static MemorySegmentPREVIEW
getWindowMonitor
(MemorySegmentPREVIEW window) Returns the monitor that the window uses for full screen mode.static float
getWindowOpacity
(MemorySegmentPREVIEW window) Returns the opacity of the whole window.static Pair.OfInt
getWindowPos
(MemorySegmentPREVIEW window) Retrieves the position of the content area of the specified window.static void
getWindowPos
(MemorySegmentPREVIEW window, int @Nullable [] xpos, int @Nullable [] ypos) Retrieves the position of the content area of the specified window.static Pair.OfInt
getWindowSize
(MemorySegmentPREVIEW window) Retrieves the size of the content area of the specified window.static void
getWindowSize
(MemorySegmentPREVIEW window, int @Nullable [] width, int @Nullable [] height) Retrieves the size of the content area of the specified window.static MemorySegmentPREVIEW
Returns the user pointer of the specified window.static void
hideWindow
(MemorySegmentPREVIEW window) Hides the specified window.static void
iconifyWindow
(MemorySegmentPREVIEW window) Iconifies the specified window.static boolean
init()
Initializes the GLFW library.static void
initHint
(int hint, int value) Sets the specified init hint to the desired value.static boolean
joystickIsGamepad
(int jid) Returns whether the specified joystick has a gamepad mapping.static boolean
joystickPresent
(int jid) Returns whether the specified joystick is present.static void
Makes the context of the specified window current for the calling thread.static void
maximizeWindow
(MemorySegmentPREVIEW window) Maximizes the specified window.static MemorySegmentPREVIEW
ncreateCursor
(MemorySegmentPREVIEW image, int xhot, int yhot) Creates a custom cursor.static MemorySegmentPREVIEW
ncreateWindow
(int width, int height, MemorySegmentPREVIEW title, MemorySegmentPREVIEW monitor, MemorySegmentPREVIEW share) Creates a window and its associated context.static boolean
nextensionSupported
(MemorySegmentPREVIEW extension) Returns whether the specified extension is available.static MemorySegmentPREVIEW
Returns the contents of the clipboard as a string.static void
ngetCursorPos
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW xpos, MemorySegmentPREVIEW ypos) Retrieves the position of the cursor relative to the content area of the window.static int
ngetError
(MemorySegmentPREVIEW description) Returns and clears the last error for the calling thread.static void
ngetFramebufferSize
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW width, MemorySegmentPREVIEW height) Retrieves the size of the framebuffer of the specified window.static MemorySegmentPREVIEW
ngetGamepadName
(int jid) Returns the human-readable gamepad name for the specified joystick.static boolean
ngetGamepadState
(int jid, MemorySegmentPREVIEW state) Retrieves the state of the specified joystick remapped as a gamepad.static MemorySegmentPREVIEW
ngetGammaRamp
(MemorySegmentPREVIEW monitor) Returns the current gamma ramp for the specified monitor.static MemorySegmentPREVIEW
ngetJoystickAxes
(int jid, MemorySegmentPREVIEW count) Returns the values of all axes of the specified joystick.static MemorySegmentPREVIEW
ngetJoystickButtons
(int jid, MemorySegmentPREVIEW count) Returns the state of all buttons of the specified joystick.static MemorySegmentPREVIEW
ngetJoystickGUID
(int jid) Returns the SDL compatible GUID of the specified joystick.static MemorySegmentPREVIEW
ngetJoystickHats
(int jid, MemorySegmentPREVIEW count) Returns the state of all hats of the specified joystick.static MemorySegmentPREVIEW
ngetJoystickName
(int jid) Returns the name of the specified joystick.static MemorySegmentPREVIEW
ngetKeyName
(int key, int scancode) Returns the layout-specific name of the specified printable key.static void
ngetMonitorContentScale
(MemorySegmentPREVIEW monitor, MemorySegmentPREVIEW xscale, MemorySegmentPREVIEW yscale) Retrieves the content scale for the specified monitor.static MemorySegmentPREVIEW
ngetMonitorName
(MemorySegmentPREVIEW monitor) Returns the name of the specified monitor.static void
ngetMonitorPhysicalSize
(MemorySegmentPREVIEW monitor, MemorySegmentPREVIEW widthMM, MemorySegmentPREVIEW heightMM) Returns the physical size of the monitor.static void
ngetMonitorPos
(MemorySegmentPREVIEW monitor, MemorySegmentPREVIEW xpos, MemorySegmentPREVIEW ypos) Returns the position of the monitor's viewport on the virtual screen.static MemorySegmentPREVIEW
ngetMonitors
(MemorySegmentPREVIEW count) Returns the currently connected monitors.static void
ngetMonitorWorkarea
(MemorySegmentPREVIEW monitor, MemorySegmentPREVIEW xpos, MemorySegmentPREVIEW ypos, MemorySegmentPREVIEW width, MemorySegmentPREVIEW height) Retrieves the work area of the monitor.static MemorySegmentPREVIEW
ngetProcAddress
(MemorySegmentPREVIEW procName) Returns the address of the specified function for the current context.static MemorySegmentPREVIEW
Returns the Vulkan instance extensions required by GLFW.static void
ngetVersion
(MemorySegmentPREVIEW major, MemorySegmentPREVIEW minor, MemorySegmentPREVIEW rev) Retrieves the version of the GLFW library.static MemorySegmentPREVIEW
Returns a string describing the compile-time configuration.static MemorySegmentPREVIEW
ngetVideoMode
(MemorySegmentPREVIEW monitor) Returns the current mode of the specified monitor.static MemorySegmentPREVIEW
ngetVideoModes
(MemorySegmentPREVIEW monitor, MemorySegmentPREVIEW count) Returns the available video modes for the specified monitor.static void
ngetWindowContentScale
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW xscale, MemorySegmentPREVIEW yscale) Retrieves the content scale for the specified window.static void
ngetWindowFrameSize
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW left, MemorySegmentPREVIEW top, MemorySegmentPREVIEW right, MemorySegmentPREVIEW bottom) Retrieves the size of the frame of the window.static void
ngetWindowPos
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW xpos, MemorySegmentPREVIEW ypos) Retrieves the position of the content area of the specified window.static void
ngetWindowSize
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW width, MemorySegmentPREVIEW height) Retrieves the size of the content area of the specified window.static MemorySegmentPREVIEW
nsetCharCallback
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the Unicode character callback.static void
Sets the clipboard to the specified string.static MemorySegmentPREVIEW
nsetCursorEnterCallback
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the cursor enter/leave callback.static MemorySegmentPREVIEW
nsetCursorPosCallback
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the cursor position callback.static MemorySegmentPREVIEW
nsetDropCallback
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the path drop callback.static MemorySegmentPREVIEW
nsetErrorCallback
(MemorySegmentPREVIEW callback) Sets the error callback.static MemorySegmentPREVIEW
nsetFramebufferSizeCallback
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the framebuffer resize callback for the specified window.static void
nsetGammaRamp
(MemorySegmentPREVIEW monitor, MemorySegmentPREVIEW ramp) Sets the current gamma ramp for the specified monitor.static MemorySegmentPREVIEW
nsetJoystickCallback
(MemorySegmentPREVIEW callback) Sets the joystick configuration callback.static MemorySegmentPREVIEW
nsetKeyCallback
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the key callback.static MemorySegmentPREVIEW
nsetMonitorCallback
(MemorySegmentPREVIEW callback) Sets the monitor configuration callback.static MemorySegmentPREVIEW
nsetMouseButtonCallback
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the mouse button callback.static MemorySegmentPREVIEW
nsetScrollCallback
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the scroll callback.static MemorySegmentPREVIEW
nsetWindowCloseCallback
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the close callback for the specified window.static MemorySegmentPREVIEW
nsetWindowContentScaleCallback
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the window content scale callback for the specified window.static MemorySegmentPREVIEW
nsetWindowFocusCallback
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the focus callback for the specified window.static void
nsetWindowIcon
(MemorySegmentPREVIEW window, int count, MemorySegmentPREVIEW images) Sets the icon for the specified window.static MemorySegmentPREVIEW
nsetWindowIconifyCallback
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the iconify callback for the specified window.static MemorySegmentPREVIEW
nsetWindowMaximizeCallback
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the maximize callback for the specified window.static MemorySegmentPREVIEW
nsetWindowPosCallback
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the position callback for the specified window.static MemorySegmentPREVIEW
nsetWindowRefreshCallback
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the refresh callback for the specified window.static MemorySegmentPREVIEW
nsetWindowSizeCallback
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the size callback for the specified window.static void
nsetWindowTitle
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW title) Sets the title of the specified window.static boolean
Adds the specified SDL_GameControllerDB gamepad mappings.static void
nwindowHintString
(int hint, MemorySegmentPREVIEW value) Sets the specified window hint to the desired value.static void
Processes all pending events.static void
Posts an empty event to the event queue.static boolean
Returns whether raw mouse motion is supported.static void
Requests user attention to the specified window.static void
restoreWindow
(MemorySegmentPREVIEW window) Restores the specified window.static MemorySegmentPREVIEW
setCharCallback
(MemorySegmentPREVIEW window, @Nullable IGLFWCharFun callback) Sets the Unicode character callback.static void
setClipboardString
(String string) Sets the clipboard to the specified string.static void
setCursor
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW cursor) Sets the cursor for the window.static MemorySegmentPREVIEW
setCursorEnterCallback
(MemorySegmentPREVIEW window, @Nullable IGLFWCursorEnterFun callback) Sets the cursor enter/leave callback.static void
setCursorPos
(MemorySegmentPREVIEW window, double xpos, double ypos) Sets the position of the cursor, relative to the content area of the window.static MemorySegmentPREVIEW
setCursorPosCallback
(MemorySegmentPREVIEW window, @Nullable IGLFWCursorPosFun callback) Sets the cursor position callback.static MemorySegmentPREVIEW
setDropCallback
(MemorySegmentPREVIEW window, @Nullable IGLFWDropFun callback) Sets the path drop callback.static MemorySegmentPREVIEW
setErrorCallback
(@Nullable IGLFWErrorFun callback) Sets the error callback.static MemorySegmentPREVIEW
setFramebufferSizeCallback
(MemorySegmentPREVIEW window, @Nullable IGLFWFramebufferSizeFun callback) Sets the framebuffer resize callback for the specified window.static void
setGamma
(MemorySegmentPREVIEW monitor, float gamma) Generates a gamma ramp and sets it for the specified monitor.static void
setGammaRamp
(MemorySegmentPREVIEW monitor, GLFWGammaRamp ramp) Sets the current gamma ramp for the specified monitor.static void
setInputMode
(MemorySegmentPREVIEW window, int mode, int value) Sets an input option for the specified window.static MemorySegmentPREVIEW
setJoystickCallback
(@Nullable IGLFWJoystickFun callback) Sets the joystick configuration callback.static void
setJoystickUserPointer
(int jid, MemorySegmentPREVIEW pointer) Sets the user pointer of the specified joystick.static MemorySegmentPREVIEW
setKeyCallback
(MemorySegmentPREVIEW window, @Nullable IGLFWKeyFun callback) Sets the key callback.static MemorySegmentPREVIEW
setMonitorCallback
(@Nullable IGLFWMonitorFun callback) Sets the monitor configuration callback.static void
setMonitorUserPointer
(MemorySegmentPREVIEW monitor, MemorySegmentPREVIEW pointer) Sets the user pointer of the specified monitor.static MemorySegmentPREVIEW
setMouseButtonCallback
(MemorySegmentPREVIEW window, @Nullable IGLFWMouseButtonFun callback) Sets the mouse button callback.static MemorySegmentPREVIEW
setScrollCallback
(MemorySegmentPREVIEW window, @Nullable IGLFWScrollFun callback) Sets the scroll callback.static void
setTime
(double time) Sets the GLFW time.static void
setWindowAspectRatio
(MemorySegmentPREVIEW window, int numer, int denom) Sets the aspect ratio of the specified window.static void
setWindowAttrib
(MemorySegmentPREVIEW window, int attrib, boolean value) Sets an attribute of the specified window.static MemorySegmentPREVIEW
setWindowCloseCallback
(MemorySegmentPREVIEW window, @Nullable IGLFWWindowCloseFun callback) Sets the close callback for the specified window.static MemorySegmentPREVIEW
setWindowContentScaleCallback
(MemorySegmentPREVIEW window, @Nullable IGLFWWindowContentScaleFun callback) Sets the window content scale callback for the specified window.static MemorySegmentPREVIEW
setWindowFocusCallback
(MemorySegmentPREVIEW window, @Nullable IGLFWWindowFocusFun callback) Sets the focus callback for the specified window.static void
setWindowIcon
(MemorySegmentPREVIEW window, int count, GLFWImage.Buffer images) Sets the icon for the specified window.static void
setWindowIcon
(MemorySegmentPREVIEW window, GLFWImage.Buffer images) Sets the icon for the specified window.static MemorySegmentPREVIEW
setWindowIconifyCallback
(MemorySegmentPREVIEW window, @Nullable IGLFWWindowIconifyFun callback) Sets the iconify callback for the specified window.static MemorySegmentPREVIEW
setWindowMaximizeCallback
(MemorySegmentPREVIEW window, @Nullable IGLFWWindowMaximizeFun callback) Sets the maximize callback for the specified window.static void
setWindowMonitor
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW monitor, int xpos, int ypos, int width, int height, int refreshRate) Sets the mode, monitor, video mode and placement of a window.static void
setWindowOpacity
(MemorySegmentPREVIEW window, float opacity) Sets the opacity of the whole window.static void
setWindowPos
(MemorySegmentPREVIEW window, int xpos, int ypos) Sets the position of the content area of the specified window.static MemorySegmentPREVIEW
setWindowPosCallback
(MemorySegmentPREVIEW window, @Nullable IGLFWWindowPosFun callback) Sets the position callback for the specified window.static MemorySegmentPREVIEW
setWindowRefreshCallback
(MemorySegmentPREVIEW window, @Nullable IGLFWWindowRefreshFun callback) Sets the refresh callback for the specified window.static void
setWindowShouldClose
(MemorySegmentPREVIEW window, boolean value) Sets the close flag of the specified window.static void
setWindowSize
(MemorySegmentPREVIEW window, int width, int height) Sets the size of the content area of the specified window.static MemorySegmentPREVIEW
setWindowSizeCallback
(MemorySegmentPREVIEW window, @Nullable IGLFWWindowSizeFun callback) Sets the size callback for the specified window.static void
setWindowSizeLimits
(MemorySegmentPREVIEW window, int minWidth, int minHeight, int maxWidth, int maxHeight) Sets the size limits of the specified window.static void
setWindowTitle
(MemorySegmentPREVIEW window, String title) Sets the title of the specified window.static void
setWindowUserPointer
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW pointer) Sets the user pointer of the specified window.static void
showWindow
(MemorySegmentPREVIEW window) Makes the specified window visible.static void
swapBuffers
(MemorySegmentPREVIEW window) Swaps the front and back buffers of the specified window.static void
swapInterval
(int interval) Sets the swap interval for the current context.static void
Terminates the GLFW library.static boolean
updateGamepadMappings
(String string) Adds the specified SDL_GameControllerDB gamepad mappings.static boolean
Returns whether the Vulkan loader and an ICD have been found.static void
Waits until events are queued and processes them.static void
waitEventsTimeout
(double timeout) Waits with timeout until events are queued and processes them.static void
windowHint
(int hint, boolean value) Sets the specified window hint to the desired value.static void
windowHint
(int hint, int value) Sets the specified window hint to the desired value.static void
windowHintString
(int hint, String value) Sets the specified window hint to the desired value.static boolean
Checks the close flag of the specified window.
-
Field Details
-
VERSION_MAJOR
public static final int VERSION_MAJORThe major version number of the GLFW header.This is incremented when the API is changed in non-compatible ways.
- See Also:
-
VERSION_MINOR
public static final int VERSION_MINORThe minor version number of the GLFW header.This is incremented when features are added to the API, but it remains backward-compatible.
- See Also:
-
VERSION_REVISION
public static final int VERSION_REVISIONThe revision number of the GLFW header.This is incremented when a bug fix release is made that does not contain any API changes.
- See Also:
-
TRUE
public static final int TRUEOne.This is only semantic sugar for the number 1. You can instead use
1
ortrue
or_True
orGL_TRUE
orVK_TRUE
or anything else that is equal to one.- See Also:
-
FALSE
public static final int FALSEZero.This is only semantic sugar for the number 0. You can instead use
0
orfalse
or_False
orGL_FALSE
orVK_FALSE
or anything else that is equal to zero.- See Also:
-
RELEASE
public static final int RELEASEThe key or mouse button was released.- See Also:
-
PRESS
public static final int PRESSThe key or mouse button was pressed.- See Also:
-
REPEAT
public static final int REPEATThe key was held down until it repeated.- See Also:
-
HAT_CENTERED
public static final int HAT_CENTEREDJoystick hat states.- See Also:
-
HAT_UP
public static final int HAT_UPJoystick hat states.- See Also:
-
HAT_RIGHT
public static final int HAT_RIGHTJoystick hat states.- See Also:
-
HAT_DOWN
public static final int HAT_DOWNJoystick hat states.- See Also:
-
HAT_LEFT
public static final int HAT_LEFTJoystick hat states.- See Also:
-
HAT_RIGHT_UP
public static final int HAT_RIGHT_UPJoystick hat states.- See Also:
-
HAT_RIGHT_DOWN
public static final int HAT_RIGHT_DOWNJoystick hat states.- See Also:
-
HAT_LEFT_UP
public static final int HAT_LEFT_UPJoystick hat states.- See Also:
-
HAT_LEFT_DOWN
public static final int HAT_LEFT_DOWNJoystick hat states.- See Also:
-
KEY_UNKNOWN
public static final int KEY_UNKNOWNThe unknown key- See Also:
-
KEY_SPACE
public static final int KEY_SPACEPrintable keys- See Also:
-
KEY_APOSTROPHE
public static final int KEY_APOSTROPHEPrintable keys- See Also:
-
KEY_COMMA
public static final int KEY_COMMAPrintable keys- See Also:
-
KEY_MINUS
public static final int KEY_MINUSPrintable keys- See Also:
-
KEY_PERIOD
public static final int KEY_PERIODPrintable keys- See Also:
-
KEY_SLASH
public static final int KEY_SLASHPrintable keys- See Also:
-
KEY_0
public static final int KEY_0Printable keys- See Also:
-
KEY_1
public static final int KEY_1Printable keys- See Also:
-
KEY_2
public static final int KEY_2Printable keys- See Also:
-
KEY_3
public static final int KEY_3Printable keys- See Also:
-
KEY_4
public static final int KEY_4Printable keys- See Also:
-
KEY_5
public static final int KEY_5Printable keys- See Also:
-
KEY_6
public static final int KEY_6Printable keys- See Also:
-
KEY_7
public static final int KEY_7Printable keys- See Also:
-
KEY_8
public static final int KEY_8Printable keys- See Also:
-
KEY_9
public static final int KEY_9Printable keys- See Also:
-
KEY_SEMICOLON
public static final int KEY_SEMICOLONPrintable keys- See Also:
-
KEY_EQUAL
public static final int KEY_EQUALPrintable keys- See Also:
-
KEY_A
public static final int KEY_APrintable keys- See Also:
-
KEY_B
public static final int KEY_BPrintable keys- See Also:
-
KEY_C
public static final int KEY_CPrintable keys- See Also:
-
KEY_D
public static final int KEY_DPrintable keys- See Also:
-
KEY_E
public static final int KEY_EPrintable keys- See Also:
-
KEY_F
public static final int KEY_FPrintable keys- See Also:
-
KEY_G
public static final int KEY_GPrintable keys- See Also:
-
KEY_H
public static final int KEY_HPrintable keys- See Also:
-
KEY_I
public static final int KEY_IPrintable keys- See Also:
-
KEY_J
public static final int KEY_JPrintable keys- See Also:
-
KEY_K
public static final int KEY_KPrintable keys- See Also:
-
KEY_L
public static final int KEY_LPrintable keys- See Also:
-
KEY_M
public static final int KEY_MPrintable keys- See Also:
-
KEY_N
public static final int KEY_NPrintable keys- See Also:
-
KEY_O
public static final int KEY_OPrintable keys- See Also:
-
KEY_P
public static final int KEY_PPrintable keys- See Also:
-
KEY_Q
public static final int KEY_QPrintable keys- See Also:
-
KEY_R
public static final int KEY_RPrintable keys- See Also:
-
KEY_S
public static final int KEY_SPrintable keys- See Also:
-
KEY_T
public static final int KEY_TPrintable keys- See Also:
-
KEY_U
public static final int KEY_UPrintable keys- See Also:
-
KEY_V
public static final int KEY_VPrintable keys- See Also:
-
KEY_W
public static final int KEY_WPrintable keys- See Also:
-
KEY_X
public static final int KEY_XPrintable keys- See Also:
-
KEY_Y
public static final int KEY_YPrintable keys- See Also:
-
KEY_Z
public static final int KEY_ZPrintable keys- See Also:
-
KEY_LEFT_BRACKET
public static final int KEY_LEFT_BRACKETPrintable keys- See Also:
-
KEY_BACKSLASH
public static final int KEY_BACKSLASHPrintable keys- See Also:
-
KEY_RIGHT_BRACKET
public static final int KEY_RIGHT_BRACKETPrintable keys- See Also:
-
KEY_GRAVE_ACCENT
public static final int KEY_GRAVE_ACCENTPrintable keys- See Also:
-
KEY_WORLD_1
public static final int KEY_WORLD_1Printable keys- See Also:
-
KEY_WORLD_2
public static final int KEY_WORLD_2Printable keys- See Also:
-
KEY_ESCAPE
public static final int KEY_ESCAPEFunction keys- See Also:
-
KEY_ENTER
public static final int KEY_ENTERFunction keys- See Also:
-
KEY_TAB
public static final int KEY_TABFunction keys- See Also:
-
KEY_BACKSPACE
public static final int KEY_BACKSPACEFunction keys- See Also:
-
KEY_INSERT
public static final int KEY_INSERTFunction keys- See Also:
-
KEY_DELETE
public static final int KEY_DELETEFunction keys- See Also:
-
KEY_RIGHT
public static final int KEY_RIGHTFunction keys- See Also:
-
KEY_LEFT
public static final int KEY_LEFTFunction keys- See Also:
-
KEY_DOWN
public static final int KEY_DOWNFunction keys- See Also:
-
KEY_UP
public static final int KEY_UPFunction keys- See Also:
-
KEY_PAGE_UP
public static final int KEY_PAGE_UPFunction keys- See Also:
-
KEY_PAGE_DOWN
public static final int KEY_PAGE_DOWNFunction keys- See Also:
-
KEY_HOME
public static final int KEY_HOMEFunction keys- See Also:
-
KEY_END
public static final int KEY_ENDFunction keys- See Also:
-
KEY_CAPS_LOCK
public static final int KEY_CAPS_LOCKFunction keys- See Also:
-
KEY_SCROLL_LOCK
public static final int KEY_SCROLL_LOCKFunction keys- See Also:
-
KEY_NUM_LOCK
public static final int KEY_NUM_LOCKFunction keys- See Also:
-
KEY_PRINT_SCREEN
public static final int KEY_PRINT_SCREENFunction keys- See Also:
-
KEY_PAUSE
public static final int KEY_PAUSEFunction keys- See Also:
-
KEY_F1
public static final int KEY_F1Function keys- See Also:
-
KEY_F2
public static final int KEY_F2Function keys- See Also:
-
KEY_F3
public static final int KEY_F3Function keys- See Also:
-
KEY_F4
public static final int KEY_F4Function keys- See Also:
-
KEY_F5
public static final int KEY_F5Function keys- See Also:
-
KEY_F6
public static final int KEY_F6Function keys- See Also:
-
KEY_F7
public static final int KEY_F7Function keys- See Also:
-
KEY_F8
public static final int KEY_F8Function keys- See Also:
-
KEY_F9
public static final int KEY_F9Function keys- See Also:
-
KEY_F10
public static final int KEY_F10Function keys- See Also:
-
KEY_F11
public static final int KEY_F11Function keys- See Also:
-
KEY_F12
public static final int KEY_F12Function keys- See Also:
-
KEY_F13
public static final int KEY_F13Function keys- See Also:
-
KEY_F14
public static final int KEY_F14Function keys- See Also:
-
KEY_F15
public static final int KEY_F15Function keys- See Also:
-
KEY_F16
public static final int KEY_F16Function keys- See Also:
-
KEY_F17
public static final int KEY_F17Function keys- See Also:
-
KEY_F18
public static final int KEY_F18Function keys- See Also:
-
KEY_F19
public static final int KEY_F19Function keys- See Also:
-
KEY_F20
public static final int KEY_F20Function keys- See Also:
-
KEY_F21
public static final int KEY_F21Function keys- See Also:
-
KEY_F22
public static final int KEY_F22Function keys- See Also:
-
KEY_F23
public static final int KEY_F23Function keys- See Also:
-
KEY_F24
public static final int KEY_F24Function keys- See Also:
-
KEY_F25
public static final int KEY_F25Function keys- See Also:
-
KEY_KP_0
public static final int KEY_KP_0Function keys- See Also:
-
KEY_KP_1
public static final int KEY_KP_1Function keys- See Also:
-
KEY_KP_2
public static final int KEY_KP_2Function keys- See Also:
-
KEY_KP_3
public static final int KEY_KP_3Function keys- See Also:
-
KEY_KP_4
public static final int KEY_KP_4Function keys- See Also:
-
KEY_KP_5
public static final int KEY_KP_5Function keys- See Also:
-
KEY_KP_6
public static final int KEY_KP_6Function keys- See Also:
-
KEY_KP_7
public static final int KEY_KP_7Function keys- See Also:
-
KEY_KP_8
public static final int KEY_KP_8Function keys- See Also:
-
KEY_KP_9
public static final int KEY_KP_9Function keys- See Also:
-
KEY_KP_DECIMAL
public static final int KEY_KP_DECIMALFunction keys- See Also:
-
KEY_KP_DIVIDE
public static final int KEY_KP_DIVIDEFunction keys- See Also:
-
KEY_KP_MULTIPLY
public static final int KEY_KP_MULTIPLYFunction keys- See Also:
-
KEY_KP_SUBTRACT
public static final int KEY_KP_SUBTRACTFunction keys- See Also:
-
KEY_KP_ADD
public static final int KEY_KP_ADDFunction keys- See Also:
-
KEY_KP_ENTER
public static final int KEY_KP_ENTERFunction keys- See Also:
-
KEY_KP_EQUAL
public static final int KEY_KP_EQUALFunction keys- See Also:
-
KEY_LEFT_SHIFT
public static final int KEY_LEFT_SHIFTFunction keys- See Also:
-
KEY_LEFT_CONTROL
public static final int KEY_LEFT_CONTROLFunction keys- See Also:
-
KEY_LEFT_ALT
public static final int KEY_LEFT_ALTFunction keys- See Also:
-
KEY_LEFT_SUPER
public static final int KEY_LEFT_SUPERFunction keys- See Also:
-
KEY_RIGHT_SHIFT
public static final int KEY_RIGHT_SHIFTFunction keys- See Also:
-
KEY_RIGHT_CONTROL
public static final int KEY_RIGHT_CONTROLFunction keys- See Also:
-
KEY_RIGHT_ALT
public static final int KEY_RIGHT_ALTFunction keys- See Also:
-
KEY_RIGHT_SUPER
public static final int KEY_RIGHT_SUPERFunction keys- See Also:
-
KEY_MENU
public static final int KEY_MENUFunction keys- See Also:
-
KEY_LAST
public static final int KEY_LAST- See Also:
-
MOD_SHIFT
public static final int MOD_SHIFTIf this bit is set one or more Shift keys were held down.- See Also:
-
MOD_CONTROL
public static final int MOD_CONTROLIf this bit is set one or more Control keys were held down.- See Also:
-
MOD_ALT
public static final int MOD_ALTIf this bit is set one or more Alt keys were held down.- See Also:
-
MOD_SUPER
public static final int MOD_SUPERIf this bit is set one or more Super keys were held down.- See Also:
-
MOD_CAPS_LOCK
public static final int MOD_CAPS_LOCKIf this bit is set the Caps Lock key is enabled and theLOCK_KEY_MODS
input mode is set.- See Also:
-
MOD_NUM_LOCK
public static final int MOD_NUM_LOCKIf this bit is set the Num Lock key is enabled and theLOCK_KEY_MODS
input mode is set.- See Also:
-
MOUSE_BUTTON_1
public static final int MOUSE_BUTTON_1Mouse button IDs.- See Also:
-
MOUSE_BUTTON_2
public static final int MOUSE_BUTTON_2Mouse button IDs.- See Also:
-
MOUSE_BUTTON_3
public static final int MOUSE_BUTTON_3Mouse button IDs.- See Also:
-
MOUSE_BUTTON_4
public static final int MOUSE_BUTTON_4Mouse button IDs.- See Also:
-
MOUSE_BUTTON_5
public static final int MOUSE_BUTTON_5Mouse button IDs.- See Also:
-
MOUSE_BUTTON_6
public static final int MOUSE_BUTTON_6Mouse button IDs.- See Also:
-
MOUSE_BUTTON_7
public static final int MOUSE_BUTTON_7Mouse button IDs.- See Also:
-
MOUSE_BUTTON_8
public static final int MOUSE_BUTTON_8Mouse button IDs.- See Also:
-
MOUSE_BUTTON_LAST
public static final int MOUSE_BUTTON_LASTMouse button IDs.- See Also:
-
MOUSE_BUTTON_LEFT
public static final int MOUSE_BUTTON_LEFTMouse button IDs.- See Also:
-
MOUSE_BUTTON_RIGHT
public static final int MOUSE_BUTTON_RIGHTMouse button IDs.- See Also:
-
MOUSE_BUTTON_MIDDLE
public static final int MOUSE_BUTTON_MIDDLEMouse button IDs.- See Also:
-
JOYSTICK_1
public static final int JOYSTICK_1Joystick IDs.- See Also:
-
JOYSTICK_2
public static final int JOYSTICK_2Joystick IDs.- See Also:
-
JOYSTICK_3
public static final int JOYSTICK_3Joystick IDs.- See Also:
-
JOYSTICK_4
public static final int JOYSTICK_4Joystick IDs.- See Also:
-
JOYSTICK_5
public static final int JOYSTICK_5Joystick IDs.- See Also:
-
JOYSTICK_6
public static final int JOYSTICK_6Joystick IDs.- See Also:
-
JOYSTICK_7
public static final int JOYSTICK_7Joystick IDs.- See Also:
-
JOYSTICK_8
public static final int JOYSTICK_8Joystick IDs.- See Also:
-
JOYSTICK_9
public static final int JOYSTICK_9Joystick IDs.- See Also:
-
JOYSTICK_10
public static final int JOYSTICK_10Joystick IDs.- See Also:
-
JOYSTICK_11
public static final int JOYSTICK_11Joystick IDs.- See Also:
-
JOYSTICK_12
public static final int JOYSTICK_12Joystick IDs.- See Also:
-
JOYSTICK_13
public static final int JOYSTICK_13Joystick IDs.- See Also:
-
JOYSTICK_14
public static final int JOYSTICK_14Joystick IDs.- See Also:
-
JOYSTICK_15
public static final int JOYSTICK_15Joystick IDs.- See Also:
-
JOYSTICK_16
public static final int JOYSTICK_16Joystick IDs.- See Also:
-
JOYSTICK_LAST
public static final int JOYSTICK_LASTJoystick IDs.- See Also:
-
GAMEPAD_BUTTON_A
public static final int GAMEPAD_BUTTON_AGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_B
public static final int GAMEPAD_BUTTON_BGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_X
public static final int GAMEPAD_BUTTON_XGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_Y
public static final int GAMEPAD_BUTTON_YGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_LEFT_BUMPER
public static final int GAMEPAD_BUTTON_LEFT_BUMPERGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_RIGHT_BUMPER
public static final int GAMEPAD_BUTTON_RIGHT_BUMPERGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_BACK
public static final int GAMEPAD_BUTTON_BACKGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_START
public static final int GAMEPAD_BUTTON_STARTGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_GUIDE
public static final int GAMEPAD_BUTTON_GUIDEGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_LEFT_THUMB
public static final int GAMEPAD_BUTTON_LEFT_THUMBGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_RIGHT_THUMB
public static final int GAMEPAD_BUTTON_RIGHT_THUMBGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_DPAD_UP
public static final int GAMEPAD_BUTTON_DPAD_UPGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_DPAD_RIGHT
public static final int GAMEPAD_BUTTON_DPAD_RIGHTGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_DPAD_DOWN
public static final int GAMEPAD_BUTTON_DPAD_DOWNGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_DPAD_LEFT
public static final int GAMEPAD_BUTTON_DPAD_LEFTGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_LAST
public static final int GAMEPAD_BUTTON_LASTGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_CROSS
public static final int GAMEPAD_BUTTON_CROSSGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_CIRCLE
public static final int GAMEPAD_BUTTON_CIRCLEGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_SQUARE
public static final int GAMEPAD_BUTTON_SQUAREGamepad buttons.- See Also:
-
GAMEPAD_BUTTON_TRIANGLE
public static final int GAMEPAD_BUTTON_TRIANGLEGamepad buttons.- See Also:
-
GAMEPAD_AXIS_LEFT_X
public static final int GAMEPAD_AXIS_LEFT_XGamepad axes.- See Also:
-
GAMEPAD_AXIS_LEFT_Y
public static final int GAMEPAD_AXIS_LEFT_YGamepad axes.- See Also:
-
GAMEPAD_AXIS_RIGHT_X
public static final int GAMEPAD_AXIS_RIGHT_XGamepad axes.- See Also:
-
GAMEPAD_AXIS_RIGHT_Y
public static final int GAMEPAD_AXIS_RIGHT_YGamepad axes.- See Also:
-
GAMEPAD_AXIS_LEFT_TRIGGER
public static final int GAMEPAD_AXIS_LEFT_TRIGGERGamepad axes.- See Also:
-
GAMEPAD_AXIS_RIGHT_TRIGGER
public static final int GAMEPAD_AXIS_RIGHT_TRIGGERGamepad axes.- See Also:
-
GAMEPAD_AXIS_LAST
public static final int GAMEPAD_AXIS_LASTGamepad axes.- See Also:
-
NO_ERROR
public static final int NO_ERRORNo error has occurred.Analysis
Yay.- See Also:
-
NOT_INITIALIZED
public static final int NOT_INITIALIZEDGLFW has not been initialized.This occurs if a GLFW function was called that must not be called unless the library is initialized.
Analysis
Application programmer error. Initialize GLFW before calling any function that requires initialization.- See Also:
-
NO_CURRENT_CONTEXT
public static final int NO_CURRENT_CONTEXTNo context is current for this thread.This occurs if a GLFW function was called that needs and operates on the current OpenGL or OpenGL ES context but no context is current on the calling thread. One such function is @ref glfwSwapInterval.
Analysis
Application programmer error. Ensure a context is current before calling functions that require a current context.- See Also:
-
INVALID_ENUM
public static final int INVALID_ENUMOne of the arguments to the function was an invalid enum value, for example requestingRED_BITS
withgetWindowAttrib(java.lang.foreign.MemorySegment, int)
PREVIEW.Analysis
Application programmer error. Fix the offending call.- See Also:
-
INVALID_VALUE
public static final int INVALID_VALUEOne of the arguments to the function was an invalid value, for example requesting a non-existent OpenGL or OpenGL ES version like 2.7.Requesting a valid but unavailable OpenGL or OpenGL ES version will instead result in a
VERSION_UNAVAILABLE
error.Analysis
Application programmer error. Fix the offending call.- See Also:
-
OUT_OF_MEMORY
public static final int OUT_OF_MEMORYA memory allocation failed.Analysis
A bug in GLFW or the underlying operating system. Report the bug to the issue tracker.- See Also:
-
API_UNAVAILABLE
public static final int API_UNAVAILABLEGLFW could not find support for the requested API on the system.Analysis
The installed graphics driver does not support the requested API, or does not support it via the chosen context creation backend. Below are a few examples.Some pre-installed Windows graphics drivers do not support OpenGL. AMD only supports OpenGL ES via EGL, while Nvidia and Intel only support it via a WGL or GLX extension. macOS does not provide OpenGL ES at all. The Mesa EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary driver. Older graphics drivers do not support Vulkan.
- See Also:
-
VERSION_UNAVAILABLE
public static final int VERSION_UNAVAILABLEThe requested OpenGL or OpenGL ES version (including any requested context or framebuffer hints) is not available on this machine.Analysis
The machine does not support your requirements. If your application is sufficiently flexible, downgrade your requirements and try again. Otherwise, inform the user that their machine does not match your requirements.Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0 comes out before the 4.x series gets that far, also fail with this error and not
INVALID_VALUE
, because GLFW cannot know what future versions will exist.- See Also:
-
PLATFORM_ERROR
public static final int PLATFORM_ERRORA platform-specific error occurred that does not match any of the more specific categories.Analysis
A bug or configuration error in GLFW, the underlying operating system or its drivers, or a lack of required resources. Report the issue to the issue tracker.- See Also:
-
FORMAT_UNAVAILABLE
public static final int FORMAT_UNAVAILABLEThe requested format is not supported or available.If emitted during window creation, the requested pixel format is not supported.
If emitted when querying the clipboard, the contents of the clipboard could not be converted to the requested format.
Analysis
If emitted during window creation, one or more hard constraints did not match any of the available pixel formats. If your application is sufficiently flexible, downgrade your requirements and try again. Otherwise, inform the user that their machine does not match your requirements.If emitted when querying the clipboard, ignore the error or report it to the user, as appropriate.
- See Also:
-
NO_WINDOW_CONTEXT
public static final int NO_WINDOW_CONTEXTThe specified window does not have an OpenGL or OpenGL ES context.A window that does not have an OpenGL or OpenGL ES context was passed to a function that requires it to have one.
Analysis
Application programmer error. Fix the offending call.- See Also:
-
FOCUSED
public static final int FOCUSEDWindow related hints
RESIZABLE
: specifies whether the windowed mode window will be resizable by the user. The window will still be resizable using thesetWindowSize(java.lang.foreign.MemorySegment, int, int)
PREVIEW function. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and undecorated windows.VISIBLE
: specifies whether the windowed mode window will be initially visible. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.DECORATED
: specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc. An undecorated window will not be resizable by the user but will still allow the user to generate close events on some platforms. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.FOCUSED
: specifies whether the windowed mode window will be given input focus when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and initially hidden windows.AUTO_ICONIFY
: specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.FLOATING
: specifies whether the windowed mode window will be floating above other regular windows, also called topmost or always-on-top. This is intended primarily for debugging purposes and cannot be used to implement proper full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.MAXIMIZED
: specifies whether the windowed mode window will be maximized when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.CENTER_CURSOR
: specifies whether the cursor should be centered over newly created full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.TRANSPARENT_FRAMEBUFFER
: specifies whether the window framebuffer will be transparent. If enabled and supported by the system, the window framebuffer alpha channel will be used to combine the framebuffer with the background. This does not affect window decorations. Possible values areTRUE
andFALSE
.FOCUS_ON_SHOW
: specifies whether the window will be given input focus whenshowWindow(java.lang.foreign.MemorySegment)
PREVIEW is called. Possible values areTRUE
andFALSE
.SCALE_TO_MONITOR
: specified whether the window content area should be resized based on the monitor content scale of any monitor it is placed on. This includes the initial placement when the window is created. Possible values areTRUE
andFALSE
.This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11. On platforms like macOS the resolution of the framebuffer is changed independently of the window size.
- See Also:
-
ICONIFIED
public static final int ICONIFIEDWindow related hints
RESIZABLE
: specifies whether the windowed mode window will be resizable by the user. The window will still be resizable using thesetWindowSize(java.lang.foreign.MemorySegment, int, int)
PREVIEW function. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and undecorated windows.VISIBLE
: specifies whether the windowed mode window will be initially visible. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.DECORATED
: specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc. An undecorated window will not be resizable by the user but will still allow the user to generate close events on some platforms. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.FOCUSED
: specifies whether the windowed mode window will be given input focus when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and initially hidden windows.AUTO_ICONIFY
: specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.FLOATING
: specifies whether the windowed mode window will be floating above other regular windows, also called topmost or always-on-top. This is intended primarily for debugging purposes and cannot be used to implement proper full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.MAXIMIZED
: specifies whether the windowed mode window will be maximized when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.CENTER_CURSOR
: specifies whether the cursor should be centered over newly created full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.TRANSPARENT_FRAMEBUFFER
: specifies whether the window framebuffer will be transparent. If enabled and supported by the system, the window framebuffer alpha channel will be used to combine the framebuffer with the background. This does not affect window decorations. Possible values areTRUE
andFALSE
.FOCUS_ON_SHOW
: specifies whether the window will be given input focus whenshowWindow(java.lang.foreign.MemorySegment)
PREVIEW is called. Possible values areTRUE
andFALSE
.SCALE_TO_MONITOR
: specified whether the window content area should be resized based on the monitor content scale of any monitor it is placed on. This includes the initial placement when the window is created. Possible values areTRUE
andFALSE
.This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11. On platforms like macOS the resolution of the framebuffer is changed independently of the window size.
- See Also:
-
RESIZABLE
public static final int RESIZABLEWindow related hints
RESIZABLE
: specifies whether the windowed mode window will be resizable by the user. The window will still be resizable using thesetWindowSize(java.lang.foreign.MemorySegment, int, int)
PREVIEW function. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and undecorated windows.VISIBLE
: specifies whether the windowed mode window will be initially visible. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.DECORATED
: specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc. An undecorated window will not be resizable by the user but will still allow the user to generate close events on some platforms. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.FOCUSED
: specifies whether the windowed mode window will be given input focus when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and initially hidden windows.AUTO_ICONIFY
: specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.FLOATING
: specifies whether the windowed mode window will be floating above other regular windows, also called topmost or always-on-top. This is intended primarily for debugging purposes and cannot be used to implement proper full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.MAXIMIZED
: specifies whether the windowed mode window will be maximized when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.CENTER_CURSOR
: specifies whether the cursor should be centered over newly created full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.TRANSPARENT_FRAMEBUFFER
: specifies whether the window framebuffer will be transparent. If enabled and supported by the system, the window framebuffer alpha channel will be used to combine the framebuffer with the background. This does not affect window decorations. Possible values areTRUE
andFALSE
.FOCUS_ON_SHOW
: specifies whether the window will be given input focus whenshowWindow(java.lang.foreign.MemorySegment)
PREVIEW is called. Possible values areTRUE
andFALSE
.SCALE_TO_MONITOR
: specified whether the window content area should be resized based on the monitor content scale of any monitor it is placed on. This includes the initial placement when the window is created. Possible values areTRUE
andFALSE
.This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11. On platforms like macOS the resolution of the framebuffer is changed independently of the window size.
- See Also:
-
VISIBLE
public static final int VISIBLEWindow related hints
RESIZABLE
: specifies whether the windowed mode window will be resizable by the user. The window will still be resizable using thesetWindowSize(java.lang.foreign.MemorySegment, int, int)
PREVIEW function. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and undecorated windows.VISIBLE
: specifies whether the windowed mode window will be initially visible. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.DECORATED
: specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc. An undecorated window will not be resizable by the user but will still allow the user to generate close events on some platforms. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.FOCUSED
: specifies whether the windowed mode window will be given input focus when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and initially hidden windows.AUTO_ICONIFY
: specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.FLOATING
: specifies whether the windowed mode window will be floating above other regular windows, also called topmost or always-on-top. This is intended primarily for debugging purposes and cannot be used to implement proper full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.MAXIMIZED
: specifies whether the windowed mode window will be maximized when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.CENTER_CURSOR
: specifies whether the cursor should be centered over newly created full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.TRANSPARENT_FRAMEBUFFER
: specifies whether the window framebuffer will be transparent. If enabled and supported by the system, the window framebuffer alpha channel will be used to combine the framebuffer with the background. This does not affect window decorations. Possible values areTRUE
andFALSE
.FOCUS_ON_SHOW
: specifies whether the window will be given input focus whenshowWindow(java.lang.foreign.MemorySegment)
PREVIEW is called. Possible values areTRUE
andFALSE
.SCALE_TO_MONITOR
: specified whether the window content area should be resized based on the monitor content scale of any monitor it is placed on. This includes the initial placement when the window is created. Possible values areTRUE
andFALSE
.This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11. On platforms like macOS the resolution of the framebuffer is changed independently of the window size.
- See Also:
-
DECORATED
public static final int DECORATEDWindow related hints
RESIZABLE
: specifies whether the windowed mode window will be resizable by the user. The window will still be resizable using thesetWindowSize(java.lang.foreign.MemorySegment, int, int)
PREVIEW function. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and undecorated windows.VISIBLE
: specifies whether the windowed mode window will be initially visible. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.DECORATED
: specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc. An undecorated window will not be resizable by the user but will still allow the user to generate close events on some platforms. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.FOCUSED
: specifies whether the windowed mode window will be given input focus when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and initially hidden windows.AUTO_ICONIFY
: specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.FLOATING
: specifies whether the windowed mode window will be floating above other regular windows, also called topmost or always-on-top. This is intended primarily for debugging purposes and cannot be used to implement proper full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.MAXIMIZED
: specifies whether the windowed mode window will be maximized when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.CENTER_CURSOR
: specifies whether the cursor should be centered over newly created full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.TRANSPARENT_FRAMEBUFFER
: specifies whether the window framebuffer will be transparent. If enabled and supported by the system, the window framebuffer alpha channel will be used to combine the framebuffer with the background. This does not affect window decorations. Possible values areTRUE
andFALSE
.FOCUS_ON_SHOW
: specifies whether the window will be given input focus whenshowWindow(java.lang.foreign.MemorySegment)
PREVIEW is called. Possible values areTRUE
andFALSE
.SCALE_TO_MONITOR
: specified whether the window content area should be resized based on the monitor content scale of any monitor it is placed on. This includes the initial placement when the window is created. Possible values areTRUE
andFALSE
.This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11. On platforms like macOS the resolution of the framebuffer is changed independently of the window size.
- See Also:
-
AUTO_ICONIFY
public static final int AUTO_ICONIFYWindow related hints
RESIZABLE
: specifies whether the windowed mode window will be resizable by the user. The window will still be resizable using thesetWindowSize(java.lang.foreign.MemorySegment, int, int)
PREVIEW function. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and undecorated windows.VISIBLE
: specifies whether the windowed mode window will be initially visible. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.DECORATED
: specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc. An undecorated window will not be resizable by the user but will still allow the user to generate close events on some platforms. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.FOCUSED
: specifies whether the windowed mode window will be given input focus when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and initially hidden windows.AUTO_ICONIFY
: specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.FLOATING
: specifies whether the windowed mode window will be floating above other regular windows, also called topmost or always-on-top. This is intended primarily for debugging purposes and cannot be used to implement proper full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.MAXIMIZED
: specifies whether the windowed mode window will be maximized when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.CENTER_CURSOR
: specifies whether the cursor should be centered over newly created full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.TRANSPARENT_FRAMEBUFFER
: specifies whether the window framebuffer will be transparent. If enabled and supported by the system, the window framebuffer alpha channel will be used to combine the framebuffer with the background. This does not affect window decorations. Possible values areTRUE
andFALSE
.FOCUS_ON_SHOW
: specifies whether the window will be given input focus whenshowWindow(java.lang.foreign.MemorySegment)
PREVIEW is called. Possible values areTRUE
andFALSE
.SCALE_TO_MONITOR
: specified whether the window content area should be resized based on the monitor content scale of any monitor it is placed on. This includes the initial placement when the window is created. Possible values areTRUE
andFALSE
.This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11. On platforms like macOS the resolution of the framebuffer is changed independently of the window size.
- See Also:
-
FLOATING
public static final int FLOATINGWindow related hints
RESIZABLE
: specifies whether the windowed mode window will be resizable by the user. The window will still be resizable using thesetWindowSize(java.lang.foreign.MemorySegment, int, int)
PREVIEW function. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and undecorated windows.VISIBLE
: specifies whether the windowed mode window will be initially visible. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.DECORATED
: specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc. An undecorated window will not be resizable by the user but will still allow the user to generate close events on some platforms. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.FOCUSED
: specifies whether the windowed mode window will be given input focus when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and initially hidden windows.AUTO_ICONIFY
: specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.FLOATING
: specifies whether the windowed mode window will be floating above other regular windows, also called topmost or always-on-top. This is intended primarily for debugging purposes and cannot be used to implement proper full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.MAXIMIZED
: specifies whether the windowed mode window will be maximized when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.CENTER_CURSOR
: specifies whether the cursor should be centered over newly created full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.TRANSPARENT_FRAMEBUFFER
: specifies whether the window framebuffer will be transparent. If enabled and supported by the system, the window framebuffer alpha channel will be used to combine the framebuffer with the background. This does not affect window decorations. Possible values areTRUE
andFALSE
.FOCUS_ON_SHOW
: specifies whether the window will be given input focus whenshowWindow(java.lang.foreign.MemorySegment)
PREVIEW is called. Possible values areTRUE
andFALSE
.SCALE_TO_MONITOR
: specified whether the window content area should be resized based on the monitor content scale of any monitor it is placed on. This includes the initial placement when the window is created. Possible values areTRUE
andFALSE
.This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11. On platforms like macOS the resolution of the framebuffer is changed independently of the window size.
- See Also:
-
MAXIMIZED
public static final int MAXIMIZEDWindow related hints
RESIZABLE
: specifies whether the windowed mode window will be resizable by the user. The window will still be resizable using thesetWindowSize(java.lang.foreign.MemorySegment, int, int)
PREVIEW function. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and undecorated windows.VISIBLE
: specifies whether the windowed mode window will be initially visible. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.DECORATED
: specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc. An undecorated window will not be resizable by the user but will still allow the user to generate close events on some platforms. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.FOCUSED
: specifies whether the windowed mode window will be given input focus when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and initially hidden windows.AUTO_ICONIFY
: specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.FLOATING
: specifies whether the windowed mode window will be floating above other regular windows, also called topmost or always-on-top. This is intended primarily for debugging purposes and cannot be used to implement proper full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.MAXIMIZED
: specifies whether the windowed mode window will be maximized when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.CENTER_CURSOR
: specifies whether the cursor should be centered over newly created full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.TRANSPARENT_FRAMEBUFFER
: specifies whether the window framebuffer will be transparent. If enabled and supported by the system, the window framebuffer alpha channel will be used to combine the framebuffer with the background. This does not affect window decorations. Possible values areTRUE
andFALSE
.FOCUS_ON_SHOW
: specifies whether the window will be given input focus whenshowWindow(java.lang.foreign.MemorySegment)
PREVIEW is called. Possible values areTRUE
andFALSE
.SCALE_TO_MONITOR
: specified whether the window content area should be resized based on the monitor content scale of any monitor it is placed on. This includes the initial placement when the window is created. Possible values areTRUE
andFALSE
.This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11. On platforms like macOS the resolution of the framebuffer is changed independently of the window size.
- See Also:
-
CENTER_CURSOR
public static final int CENTER_CURSORWindow related hints
RESIZABLE
: specifies whether the windowed mode window will be resizable by the user. The window will still be resizable using thesetWindowSize(java.lang.foreign.MemorySegment, int, int)
PREVIEW function. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and undecorated windows.VISIBLE
: specifies whether the windowed mode window will be initially visible. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.DECORATED
: specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc. An undecorated window will not be resizable by the user but will still allow the user to generate close events on some platforms. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.FOCUSED
: specifies whether the windowed mode window will be given input focus when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and initially hidden windows.AUTO_ICONIFY
: specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.FLOATING
: specifies whether the windowed mode window will be floating above other regular windows, also called topmost or always-on-top. This is intended primarily for debugging purposes and cannot be used to implement proper full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.MAXIMIZED
: specifies whether the windowed mode window will be maximized when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.CENTER_CURSOR
: specifies whether the cursor should be centered over newly created full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.TRANSPARENT_FRAMEBUFFER
: specifies whether the window framebuffer will be transparent. If enabled and supported by the system, the window framebuffer alpha channel will be used to combine the framebuffer with the background. This does not affect window decorations. Possible values areTRUE
andFALSE
.FOCUS_ON_SHOW
: specifies whether the window will be given input focus whenshowWindow(java.lang.foreign.MemorySegment)
PREVIEW is called. Possible values areTRUE
andFALSE
.SCALE_TO_MONITOR
: specified whether the window content area should be resized based on the monitor content scale of any monitor it is placed on. This includes the initial placement when the window is created. Possible values areTRUE
andFALSE
.This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11. On platforms like macOS the resolution of the framebuffer is changed independently of the window size.
- See Also:
-
TRANSPARENT_FRAMEBUFFER
public static final int TRANSPARENT_FRAMEBUFFERWindow related hints
RESIZABLE
: specifies whether the windowed mode window will be resizable by the user. The window will still be resizable using thesetWindowSize(java.lang.foreign.MemorySegment, int, int)
PREVIEW function. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and undecorated windows.VISIBLE
: specifies whether the windowed mode window will be initially visible. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.DECORATED
: specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc. An undecorated window will not be resizable by the user but will still allow the user to generate close events on some platforms. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.FOCUSED
: specifies whether the windowed mode window will be given input focus when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and initially hidden windows.AUTO_ICONIFY
: specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.FLOATING
: specifies whether the windowed mode window will be floating above other regular windows, also called topmost or always-on-top. This is intended primarily for debugging purposes and cannot be used to implement proper full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.MAXIMIZED
: specifies whether the windowed mode window will be maximized when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.CENTER_CURSOR
: specifies whether the cursor should be centered over newly created full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.TRANSPARENT_FRAMEBUFFER
: specifies whether the window framebuffer will be transparent. If enabled and supported by the system, the window framebuffer alpha channel will be used to combine the framebuffer with the background. This does not affect window decorations. Possible values areTRUE
andFALSE
.FOCUS_ON_SHOW
: specifies whether the window will be given input focus whenshowWindow(java.lang.foreign.MemorySegment)
PREVIEW is called. Possible values areTRUE
andFALSE
.SCALE_TO_MONITOR
: specified whether the window content area should be resized based on the monitor content scale of any monitor it is placed on. This includes the initial placement when the window is created. Possible values areTRUE
andFALSE
.This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11. On platforms like macOS the resolution of the framebuffer is changed independently of the window size.
- See Also:
-
FOCUS_ON_SHOW
public static final int FOCUS_ON_SHOWWindow related hints
RESIZABLE
: specifies whether the windowed mode window will be resizable by the user. The window will still be resizable using thesetWindowSize(java.lang.foreign.MemorySegment, int, int)
PREVIEW function. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and undecorated windows.VISIBLE
: specifies whether the windowed mode window will be initially visible. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.DECORATED
: specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc. An undecorated window will not be resizable by the user but will still allow the user to generate close events on some platforms. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.FOCUSED
: specifies whether the windowed mode window will be given input focus when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and initially hidden windows.AUTO_ICONIFY
: specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.FLOATING
: specifies whether the windowed mode window will be floating above other regular windows, also called topmost or always-on-top. This is intended primarily for debugging purposes and cannot be used to implement proper full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.MAXIMIZED
: specifies whether the windowed mode window will be maximized when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.CENTER_CURSOR
: specifies whether the cursor should be centered over newly created full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.TRANSPARENT_FRAMEBUFFER
: specifies whether the window framebuffer will be transparent. If enabled and supported by the system, the window framebuffer alpha channel will be used to combine the framebuffer with the background. This does not affect window decorations. Possible values areTRUE
andFALSE
.FOCUS_ON_SHOW
: specifies whether the window will be given input focus whenshowWindow(java.lang.foreign.MemorySegment)
PREVIEW is called. Possible values areTRUE
andFALSE
.SCALE_TO_MONITOR
: specified whether the window content area should be resized based on the monitor content scale of any monitor it is placed on. This includes the initial placement when the window is created. Possible values areTRUE
andFALSE
.This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11. On platforms like macOS the resolution of the framebuffer is changed independently of the window size.
- See Also:
-
SCALE_TO_MONITOR
public static final int SCALE_TO_MONITORWindow related hints
RESIZABLE
: specifies whether the windowed mode window will be resizable by the user. The window will still be resizable using thesetWindowSize(java.lang.foreign.MemorySegment, int, int)
PREVIEW function. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and undecorated windows.VISIBLE
: specifies whether the windowed mode window will be initially visible. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.DECORATED
: specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc. An undecorated window will not be resizable by the user but will still allow the user to generate close events on some platforms. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.FOCUSED
: specifies whether the windowed mode window will be given input focus when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen and initially hidden windows.AUTO_ICONIFY
: specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.FLOATING
: specifies whether the windowed mode window will be floating above other regular windows, also called topmost or always-on-top. This is intended primarily for debugging purposes and cannot be used to implement proper full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.MAXIMIZED
: specifies whether the windowed mode window will be maximized when created. Possible values areTRUE
andFALSE
. This hint is ignored for full screen windows.CENTER_CURSOR
: specifies whether the cursor should be centered over newly created full screen windows. Possible values areTRUE
andFALSE
. This hint is ignored for windowed mode windows.TRANSPARENT_FRAMEBUFFER
: specifies whether the window framebuffer will be transparent. If enabled and supported by the system, the window framebuffer alpha channel will be used to combine the framebuffer with the background. This does not affect window decorations. Possible values areTRUE
andFALSE
.FOCUS_ON_SHOW
: specifies whether the window will be given input focus whenshowWindow(java.lang.foreign.MemorySegment)
PREVIEW is called. Possible values areTRUE
andFALSE
.SCALE_TO_MONITOR
: specified whether the window content area should be resized based on the monitor content scale of any monitor it is placed on. This includes the initial placement when the window is created. Possible values areTRUE
andFALSE
.This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11. On platforms like macOS the resolution of the framebuffer is changed independently of the window size.
- See Also:
-
HOVERED
public static final int HOVEREDHOVERED indicates whether the cursor is currently directly over the content area of the window, with no other windows between. See Cursor enter/leave events for details.- See Also:
-
RED_BITS
public static final int RED_BITSFramebuffer related hints
RED_BITS
,GREEN_BITS
,BLUE_BITS
,ALPHA_BITS
,DEPTH_BITS
andSTENCIL_BITS
: specify the desired bit depths of the various components of the default framebuffer. A value ofDONT_CARE
means the application has no preference.ACCUM_RED_BITS
,ACCUM_GREEN_BITS
,ACCUM_BLUE_BITS
andACCUM_ALPHA_BITS
: specify the desired bit depths of the various components of the accumulation buffer. A value ofDONT_CARE
means the application has no preference.Accumulation buffers are a legacy OpenGL feature and should not be used in new code.
AUX_BUFFERS
: specifies the desired number of auxiliary buffers. A value ofDONT_CARE
means the application has no preference.Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.
STEREO
: specifies whether to use OpenGL stereoscopic rendering. Possible values areTRUE
andFALSE
. This is a hard constraint.SAMPLES
: specifies the desired number of samples to use for multisampling. Zero disables multisampling. A value ofDONT_CARE
means the application has no preference.SRGB_CAPABLE
: specifies whether the framebuffer should be sRGB capable. Possible values areTRUE
andFALSE
.Note
OpenGL: If enabled and supported by the system, theGL_FRAMEBUFFER_SRGB
enable will control sRGB rendering. By default, sRGB rendering will be disabled.
OpenGL ES: If enabled and supported by the system, the context will always have sRGB rendering enabled.DOUBLEBUFFER
: specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint. Possible values areTRUE
andFALSE
.
- See Also:
-
GREEN_BITS
public static final int GREEN_BITSFramebuffer related hints
RED_BITS
,GREEN_BITS
,BLUE_BITS
,ALPHA_BITS
,DEPTH_BITS
andSTENCIL_BITS
: specify the desired bit depths of the various components of the default framebuffer. A value ofDONT_CARE
means the application has no preference.ACCUM_RED_BITS
,ACCUM_GREEN_BITS
,ACCUM_BLUE_BITS
andACCUM_ALPHA_BITS
: specify the desired bit depths of the various components of the accumulation buffer. A value ofDONT_CARE
means the application has no preference.Accumulation buffers are a legacy OpenGL feature and should not be used in new code.
AUX_BUFFERS
: specifies the desired number of auxiliary buffers. A value ofDONT_CARE
means the application has no preference.Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.
STEREO
: specifies whether to use OpenGL stereoscopic rendering. Possible values areTRUE
andFALSE
. This is a hard constraint.SAMPLES
: specifies the desired number of samples to use for multisampling. Zero disables multisampling. A value ofDONT_CARE
means the application has no preference.SRGB_CAPABLE
: specifies whether the framebuffer should be sRGB capable. Possible values areTRUE
andFALSE
.Note
OpenGL: If enabled and supported by the system, theGL_FRAMEBUFFER_SRGB
enable will control sRGB rendering. By default, sRGB rendering will be disabled.
OpenGL ES: If enabled and supported by the system, the context will always have sRGB rendering enabled.DOUBLEBUFFER
: specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint. Possible values areTRUE
andFALSE
.
- See Also:
-
BLUE_BITS
public static final int BLUE_BITSFramebuffer related hints
RED_BITS
,GREEN_BITS
,BLUE_BITS
,ALPHA_BITS
,DEPTH_BITS
andSTENCIL_BITS
: specify the desired bit depths of the various components of the default framebuffer. A value ofDONT_CARE
means the application has no preference.ACCUM_RED_BITS
,ACCUM_GREEN_BITS
,ACCUM_BLUE_BITS
andACCUM_ALPHA_BITS
: specify the desired bit depths of the various components of the accumulation buffer. A value ofDONT_CARE
means the application has no preference.Accumulation buffers are a legacy OpenGL feature and should not be used in new code.
AUX_BUFFERS
: specifies the desired number of auxiliary buffers. A value ofDONT_CARE
means the application has no preference.Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.
STEREO
: specifies whether to use OpenGL stereoscopic rendering. Possible values areTRUE
andFALSE
. This is a hard constraint.SAMPLES
: specifies the desired number of samples to use for multisampling. Zero disables multisampling. A value ofDONT_CARE
means the application has no preference.SRGB_CAPABLE
: specifies whether the framebuffer should be sRGB capable. Possible values areTRUE
andFALSE
.Note
OpenGL: If enabled and supported by the system, theGL_FRAMEBUFFER_SRGB
enable will control sRGB rendering. By default, sRGB rendering will be disabled.
OpenGL ES: If enabled and supported by the system, the context will always have sRGB rendering enabled.DOUBLEBUFFER
: specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint. Possible values areTRUE
andFALSE
.
- See Also:
-
ALPHA_BITS
public static final int ALPHA_BITSFramebuffer related hints
RED_BITS
,GREEN_BITS
,BLUE_BITS
,ALPHA_BITS
,DEPTH_BITS
andSTENCIL_BITS
: specify the desired bit depths of the various components of the default framebuffer. A value ofDONT_CARE
means the application has no preference.ACCUM_RED_BITS
,ACCUM_GREEN_BITS
,ACCUM_BLUE_BITS
andACCUM_ALPHA_BITS
: specify the desired bit depths of the various components of the accumulation buffer. A value ofDONT_CARE
means the application has no preference.Accumulation buffers are a legacy OpenGL feature and should not be used in new code.
AUX_BUFFERS
: specifies the desired number of auxiliary buffers. A value ofDONT_CARE
means the application has no preference.Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.
STEREO
: specifies whether to use OpenGL stereoscopic rendering. Possible values areTRUE
andFALSE
. This is a hard constraint.SAMPLES
: specifies the desired number of samples to use for multisampling. Zero disables multisampling. A value ofDONT_CARE
means the application has no preference.SRGB_CAPABLE
: specifies whether the framebuffer should be sRGB capable. Possible values areTRUE
andFALSE
.Note
OpenGL: If enabled and supported by the system, theGL_FRAMEBUFFER_SRGB
enable will control sRGB rendering. By default, sRGB rendering will be disabled.
OpenGL ES: If enabled and supported by the system, the context will always have sRGB rendering enabled.DOUBLEBUFFER
: specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint. Possible values areTRUE
andFALSE
.
- See Also:
-
DEPTH_BITS
public static final int DEPTH_BITSFramebuffer related hints
RED_BITS
,GREEN_BITS
,BLUE_BITS
,ALPHA_BITS
,DEPTH_BITS
andSTENCIL_BITS
: specify the desired bit depths of the various components of the default framebuffer. A value ofDONT_CARE
means the application has no preference.ACCUM_RED_BITS
,ACCUM_GREEN_BITS
,ACCUM_BLUE_BITS
andACCUM_ALPHA_BITS
: specify the desired bit depths of the various components of the accumulation buffer. A value ofDONT_CARE
means the application has no preference.Accumulation buffers are a legacy OpenGL feature and should not be used in new code.
AUX_BUFFERS
: specifies the desired number of auxiliary buffers. A value ofDONT_CARE
means the application has no preference.Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.
STEREO
: specifies whether to use OpenGL stereoscopic rendering. Possible values areTRUE
andFALSE
. This is a hard constraint.SAMPLES
: specifies the desired number of samples to use for multisampling. Zero disables multisampling. A value ofDONT_CARE
means the application has no preference.SRGB_CAPABLE
: specifies whether the framebuffer should be sRGB capable. Possible values areTRUE
andFALSE
.Note
OpenGL: If enabled and supported by the system, theGL_FRAMEBUFFER_SRGB
enable will control sRGB rendering. By default, sRGB rendering will be disabled.
OpenGL ES: If enabled and supported by the system, the context will always have sRGB rendering enabled.DOUBLEBUFFER
: specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint. Possible values areTRUE
andFALSE
.
- See Also:
-
STENCIL_BITS
public static final int STENCIL_BITSFramebuffer related hints
RED_BITS
,GREEN_BITS
,BLUE_BITS
,ALPHA_BITS
,DEPTH_BITS
andSTENCIL_BITS
: specify the desired bit depths of the various components of the default framebuffer. A value ofDONT_CARE
means the application has no preference.ACCUM_RED_BITS
,ACCUM_GREEN_BITS
,ACCUM_BLUE_BITS
andACCUM_ALPHA_BITS
: specify the desired bit depths of the various components of the accumulation buffer. A value ofDONT_CARE
means the application has no preference.Accumulation buffers are a legacy OpenGL feature and should not be used in new code.
AUX_BUFFERS
: specifies the desired number of auxiliary buffers. A value ofDONT_CARE
means the application has no preference.Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.
STEREO
: specifies whether to use OpenGL stereoscopic rendering. Possible values areTRUE
andFALSE
. This is a hard constraint.SAMPLES
: specifies the desired number of samples to use for multisampling. Zero disables multisampling. A value ofDONT_CARE
means the application has no preference.SRGB_CAPABLE
: specifies whether the framebuffer should be sRGB capable. Possible values areTRUE
andFALSE
.Note
OpenGL: If enabled and supported by the system, theGL_FRAMEBUFFER_SRGB
enable will control sRGB rendering. By default, sRGB rendering will be disabled.
OpenGL ES: If enabled and supported by the system, the context will always have sRGB rendering enabled.DOUBLEBUFFER
: specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint. Possible values areTRUE
andFALSE
.
- See Also:
-
ACCUM_RED_BITS
public static final int ACCUM_RED_BITSFramebuffer related hints
RED_BITS
,GREEN_BITS
,BLUE_BITS
,ALPHA_BITS
,DEPTH_BITS
andSTENCIL_BITS
: specify the desired bit depths of the various components of the default framebuffer. A value ofDONT_CARE
means the application has no preference.ACCUM_RED_BITS
,ACCUM_GREEN_BITS
,ACCUM_BLUE_BITS
andACCUM_ALPHA_BITS
: specify the desired bit depths of the various components of the accumulation buffer. A value ofDONT_CARE
means the application has no preference.Accumulation buffers are a legacy OpenGL feature and should not be used in new code.
AUX_BUFFERS
: specifies the desired number of auxiliary buffers. A value ofDONT_CARE
means the application has no preference.Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.
STEREO
: specifies whether to use OpenGL stereoscopic rendering. Possible values areTRUE
andFALSE
. This is a hard constraint.SAMPLES
: specifies the desired number of samples to use for multisampling. Zero disables multisampling. A value ofDONT_CARE
means the application has no preference.SRGB_CAPABLE
: specifies whether the framebuffer should be sRGB capable. Possible values areTRUE
andFALSE
.Note
OpenGL: If enabled and supported by the system, theGL_FRAMEBUFFER_SRGB
enable will control sRGB rendering. By default, sRGB rendering will be disabled.
OpenGL ES: If enabled and supported by the system, the context will always have sRGB rendering enabled.DOUBLEBUFFER
: specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint. Possible values areTRUE
andFALSE
.
- See Also:
-
ACCUM_GREEN_BITS
public static final int ACCUM_GREEN_BITSFramebuffer related hints
RED_BITS
,GREEN_BITS
,BLUE_BITS
,ALPHA_BITS
,DEPTH_BITS
andSTENCIL_BITS
: specify the desired bit depths of the various components of the default framebuffer. A value ofDONT_CARE
means the application has no preference.ACCUM_RED_BITS
,ACCUM_GREEN_BITS
,ACCUM_BLUE_BITS
andACCUM_ALPHA_BITS
: specify the desired bit depths of the various components of the accumulation buffer. A value ofDONT_CARE
means the application has no preference.Accumulation buffers are a legacy OpenGL feature and should not be used in new code.
AUX_BUFFERS
: specifies the desired number of auxiliary buffers. A value ofDONT_CARE
means the application has no preference.Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.
STEREO
: specifies whether to use OpenGL stereoscopic rendering. Possible values areTRUE
andFALSE
. This is a hard constraint.SAMPLES
: specifies the desired number of samples to use for multisampling. Zero disables multisampling. A value ofDONT_CARE
means the application has no preference.SRGB_CAPABLE
: specifies whether the framebuffer should be sRGB capable. Possible values areTRUE
andFALSE
.Note
OpenGL: If enabled and supported by the system, theGL_FRAMEBUFFER_SRGB
enable will control sRGB rendering. By default, sRGB rendering will be disabled.
OpenGL ES: If enabled and supported by the system, the context will always have sRGB rendering enabled.DOUBLEBUFFER
: specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint. Possible values areTRUE
andFALSE
.
- See Also:
-
ACCUM_BLUE_BITS
public static final int ACCUM_BLUE_BITSFramebuffer related hints
RED_BITS
,GREEN_BITS
,BLUE_BITS
,ALPHA_BITS
,DEPTH_BITS
andSTENCIL_BITS
: specify the desired bit depths of the various components of the default framebuffer. A value ofDONT_CARE
means the application has no preference.ACCUM_RED_BITS
,ACCUM_GREEN_BITS
,ACCUM_BLUE_BITS
andACCUM_ALPHA_BITS
: specify the desired bit depths of the various components of the accumulation buffer. A value ofDONT_CARE
means the application has no preference.Accumulation buffers are a legacy OpenGL feature and should not be used in new code.
AUX_BUFFERS
: specifies the desired number of auxiliary buffers. A value ofDONT_CARE
means the application has no preference.Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.
STEREO
: specifies whether to use OpenGL stereoscopic rendering. Possible values areTRUE
andFALSE
. This is a hard constraint.SAMPLES
: specifies the desired number of samples to use for multisampling. Zero disables multisampling. A value ofDONT_CARE
means the application has no preference.SRGB_CAPABLE
: specifies whether the framebuffer should be sRGB capable. Possible values areTRUE
andFALSE
.Note
OpenGL: If enabled and supported by the system, theGL_FRAMEBUFFER_SRGB
enable will control sRGB rendering. By default, sRGB rendering will be disabled.
OpenGL ES: If enabled and supported by the system, the context will always have sRGB rendering enabled.DOUBLEBUFFER
: specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint. Possible values areTRUE
andFALSE
.
- See Also:
-
ACCUM_ALPHA_BITS
public static final int ACCUM_ALPHA_BITSFramebuffer related hints
RED_BITS
,GREEN_BITS
,BLUE_BITS
,ALPHA_BITS
,DEPTH_BITS
andSTENCIL_BITS
: specify the desired bit depths of the various components of the default framebuffer. A value ofDONT_CARE
means the application has no preference.ACCUM_RED_BITS
,ACCUM_GREEN_BITS
,ACCUM_BLUE_BITS
andACCUM_ALPHA_BITS
: specify the desired bit depths of the various components of the accumulation buffer. A value ofDONT_CARE
means the application has no preference.Accumulation buffers are a legacy OpenGL feature and should not be used in new code.
AUX_BUFFERS
: specifies the desired number of auxiliary buffers. A value ofDONT_CARE
means the application has no preference.Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.
STEREO
: specifies whether to use OpenGL stereoscopic rendering. Possible values areTRUE
andFALSE
. This is a hard constraint.SAMPLES
: specifies the desired number of samples to use for multisampling. Zero disables multisampling. A value ofDONT_CARE
means the application has no preference.SRGB_CAPABLE
: specifies whether the framebuffer should be sRGB capable. Possible values areTRUE
andFALSE
.Note
OpenGL: If enabled and supported by the system, theGL_FRAMEBUFFER_SRGB
enable will control sRGB rendering. By default, sRGB rendering will be disabled.
OpenGL ES: If enabled and supported by the system, the context will always have sRGB rendering enabled.DOUBLEBUFFER
: specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint. Possible values areTRUE
andFALSE
.
- See Also:
-
AUX_BUFFERS
public static final int AUX_BUFFERSFramebuffer related hints
RED_BITS
,GREEN_BITS
,BLUE_BITS
,ALPHA_BITS
,DEPTH_BITS
andSTENCIL_BITS
: specify the desired bit depths of the various components of the default framebuffer. A value ofDONT_CARE
means the application has no preference.ACCUM_RED_BITS
,ACCUM_GREEN_BITS
,ACCUM_BLUE_BITS
andACCUM_ALPHA_BITS
: specify the desired bit depths of the various components of the accumulation buffer. A value ofDONT_CARE
means the application has no preference.Accumulation buffers are a legacy OpenGL feature and should not be used in new code.
AUX_BUFFERS
: specifies the desired number of auxiliary buffers. A value ofDONT_CARE
means the application has no preference.Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.
STEREO
: specifies whether to use OpenGL stereoscopic rendering. Possible values areTRUE
andFALSE
. This is a hard constraint.SAMPLES
: specifies the desired number of samples to use for multisampling. Zero disables multisampling. A value ofDONT_CARE
means the application has no preference.SRGB_CAPABLE
: specifies whether the framebuffer should be sRGB capable. Possible values areTRUE
andFALSE
.Note
OpenGL: If enabled and supported by the system, theGL_FRAMEBUFFER_SRGB
enable will control sRGB rendering. By default, sRGB rendering will be disabled.
OpenGL ES: If enabled and supported by the system, the context will always have sRGB rendering enabled.DOUBLEBUFFER
: specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint. Possible values areTRUE
andFALSE
.
- See Also:
-
STEREO
public static final int STEREOFramebuffer related hints
RED_BITS
,GREEN_BITS
,BLUE_BITS
,ALPHA_BITS
,DEPTH_BITS
andSTENCIL_BITS
: specify the desired bit depths of the various components of the default framebuffer. A value ofDONT_CARE
means the application has no preference.ACCUM_RED_BITS
,ACCUM_GREEN_BITS
,ACCUM_BLUE_BITS
andACCUM_ALPHA_BITS
: specify the desired bit depths of the various components of the accumulation buffer. A value ofDONT_CARE
means the application has no preference.Accumulation buffers are a legacy OpenGL feature and should not be used in new code.
AUX_BUFFERS
: specifies the desired number of auxiliary buffers. A value ofDONT_CARE
means the application has no preference.Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.
STEREO
: specifies whether to use OpenGL stereoscopic rendering. Possible values areTRUE
andFALSE
. This is a hard constraint.SAMPLES
: specifies the desired number of samples to use for multisampling. Zero disables multisampling. A value ofDONT_CARE
means the application has no preference.SRGB_CAPABLE
: specifies whether the framebuffer should be sRGB capable. Possible values areTRUE
andFALSE
.Note
OpenGL: If enabled and supported by the system, theGL_FRAMEBUFFER_SRGB
enable will control sRGB rendering. By default, sRGB rendering will be disabled.
OpenGL ES: If enabled and supported by the system, the context will always have sRGB rendering enabled.DOUBLEBUFFER
: specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint. Possible values areTRUE
andFALSE
.
- See Also:
-
SAMPLES
public static final int SAMPLESFramebuffer related hints
RED_BITS
,GREEN_BITS
,BLUE_BITS
,ALPHA_BITS
,DEPTH_BITS
andSTENCIL_BITS
: specify the desired bit depths of the various components of the default framebuffer. A value ofDONT_CARE
means the application has no preference.ACCUM_RED_BITS
,ACCUM_GREEN_BITS
,ACCUM_BLUE_BITS
andACCUM_ALPHA_BITS
: specify the desired bit depths of the various components of the accumulation buffer. A value ofDONT_CARE
means the application has no preference.Accumulation buffers are a legacy OpenGL feature and should not be used in new code.
AUX_BUFFERS
: specifies the desired number of auxiliary buffers. A value ofDONT_CARE
means the application has no preference.Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.
STEREO
: specifies whether to use OpenGL stereoscopic rendering. Possible values areTRUE
andFALSE
. This is a hard constraint.SAMPLES
: specifies the desired number of samples to use for multisampling. Zero disables multisampling. A value ofDONT_CARE
means the application has no preference.SRGB_CAPABLE
: specifies whether the framebuffer should be sRGB capable. Possible values areTRUE
andFALSE
.Note
OpenGL: If enabled and supported by the system, theGL_FRAMEBUFFER_SRGB
enable will control sRGB rendering. By default, sRGB rendering will be disabled.
OpenGL ES: If enabled and supported by the system, the context will always have sRGB rendering enabled.DOUBLEBUFFER
: specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint. Possible values areTRUE
andFALSE
.
- See Also:
-
SRGB_CAPABLE
public static final int SRGB_CAPABLEFramebuffer related hints
RED_BITS
,GREEN_BITS
,BLUE_BITS
,ALPHA_BITS
,DEPTH_BITS
andSTENCIL_BITS
: specify the desired bit depths of the various components of the default framebuffer. A value ofDONT_CARE
means the application has no preference.ACCUM_RED_BITS
,ACCUM_GREEN_BITS
,ACCUM_BLUE_BITS
andACCUM_ALPHA_BITS
: specify the desired bit depths of the various components of the accumulation buffer. A value ofDONT_CARE
means the application has no preference.Accumulation buffers are a legacy OpenGL feature and should not be used in new code.
AUX_BUFFERS
: specifies the desired number of auxiliary buffers. A value ofDONT_CARE
means the application has no preference.Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.
STEREO
: specifies whether to use OpenGL stereoscopic rendering. Possible values areTRUE
andFALSE
. This is a hard constraint.SAMPLES
: specifies the desired number of samples to use for multisampling. Zero disables multisampling. A value ofDONT_CARE
means the application has no preference.SRGB_CAPABLE
: specifies whether the framebuffer should be sRGB capable. Possible values areTRUE
andFALSE
.Note
OpenGL: If enabled and supported by the system, theGL_FRAMEBUFFER_SRGB
enable will control sRGB rendering. By default, sRGB rendering will be disabled.
OpenGL ES: If enabled and supported by the system, the context will always have sRGB rendering enabled.DOUBLEBUFFER
: specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint. Possible values areTRUE
andFALSE
.
- See Also:
-
DOUBLEBUFFER
public static final int DOUBLEBUFFERFramebuffer related hints
RED_BITS
,GREEN_BITS
,BLUE_BITS
,ALPHA_BITS
,DEPTH_BITS
andSTENCIL_BITS
: specify the desired bit depths of the various components of the default framebuffer. A value ofDONT_CARE
means the application has no preference.ACCUM_RED_BITS
,ACCUM_GREEN_BITS
,ACCUM_BLUE_BITS
andACCUM_ALPHA_BITS
: specify the desired bit depths of the various components of the accumulation buffer. A value ofDONT_CARE
means the application has no preference.Accumulation buffers are a legacy OpenGL feature and should not be used in new code.
AUX_BUFFERS
: specifies the desired number of auxiliary buffers. A value ofDONT_CARE
means the application has no preference.Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.
STEREO
: specifies whether to use OpenGL stereoscopic rendering. Possible values areTRUE
andFALSE
. This is a hard constraint.SAMPLES
: specifies the desired number of samples to use for multisampling. Zero disables multisampling. A value ofDONT_CARE
means the application has no preference.SRGB_CAPABLE
: specifies whether the framebuffer should be sRGB capable. Possible values areTRUE
andFALSE
.Note
OpenGL: If enabled and supported by the system, theGL_FRAMEBUFFER_SRGB
enable will control sRGB rendering. By default, sRGB rendering will be disabled.
OpenGL ES: If enabled and supported by the system, the context will always have sRGB rendering enabled.DOUBLEBUFFER
: specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint. Possible values areTRUE
andFALSE
.
- See Also:
-
REFRESH_RATE
public static final int REFRESH_RATEREFRESH_RATE specifies the desired refresh rate for full screen windows. A value ofDONT_CARE
means the highest available refresh rate will be used. This hint is ignored for windowed mode windows.- See Also:
-
CLIENT_API
public static final int CLIENT_APIContext related hints
CLIENT_API
: specifies which client API to create the context for. Possible values areOPENGL_API
,OPENGL_ES_API
andNO_API
. This is a hard constraint.CONTEXT_CREATION_API
: specifies which context creation API to use to create the context. Possible values areNATIVE_CONTEXT_API
,EGL_CONTEXT_API
andOSMESA_CONTEXT_API
. This is a hard constraint. If no client API is requested, this hint is ignored.An extension loader library that assumes it knows which API was used to create the current context may fail if you change this hint. This can be resolved by having it load functions via
getProcAddress
PREVIEW.Note
Wayland: The EGL API is the native context creation API, so this hint will have no effect.
X11: On some Linux systems, creating contexts via both the native and EGL APIs in a single process will cause the application to segfault. Stick to one API or the other on Linux for now.
OSMesa: As its name implies, an OpenGL context created with OSMesa does not update the window contents when its buffers are swapped. Use OpenGL functions or the OSMesa native access functionsgetOSMesaColorBuffer
PREVIEW andgetOSMesaDepthBuffer
PREVIEW to retrieve the framebuffer contents.CONTEXT_VERSION_MAJOR
andCONTEXT_VERSION_MINOR
: specify the client API version that the created context must be compatible with. The exact behavior of these hints depend on the requested client API.While there is no way to ask the driver for a context of the highest supported version, GLFW will attempt to provide this when you ask for a version 1.0 context, which is the default for these hints.
Do not confuse these hints with
VERSION_MAJOR
andVERSION_MINOR
, which provide the API version of the GLFW header.Note
OpenGL: These hints are not hard constraints, but creation will fail if the OpenGL version of the created context is less than the one requested. It is therefore perfectly safe to use the default of version 1.0 for legacy code and you will still get backwards-compatible contexts of version 3.0 and above when available.
OpenGL ES: These hints are not hard constraints, but creation will fail if the OpenGL ES version of the created context is less than the one requested. Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested, and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0, but OpenGL ES 2.0 is not backward compatible with 1.x.
macOS: 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 theOPENGL_FORWARD_COMPAT
andOPENGL_PROFILE
hints accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.OPENGL_FORWARD_COMPAT
: specifies whether the OpenGL context should be forward-compatible, i.e. one where all functionality deprecated in the requested version of OpenGL is removed. This must only be used if the requested OpenGL version is 3.0 or above. If OpenGL ES is requested, this hint is ignored.Forward-compatibility is described in detail in the OpenGL Reference Manual.
OPENGL_DEBUG_CONTEXT
: specifies whether the context should be created in debug mode, which may provide additional error and diagnostic reporting functionality. Possible values areTRUE
andFALSE
.Debug contexts for OpenGL and OpenGL ES are described in detail by the GL_KHR_debug extension.
OPENGL_PROFILE
: specifies which OpenGL profile to create the context for. Possible values are one ofOPENGL_CORE_PROFILE
orOPENGL_COMPAT_PROFILE
, orOPENGL_ANY_PROFILE
to not request a specific profile. If requesting an OpenGL version below 3.2,OPENGL_ANY_PROFILE
must be used. If OpenGL ES is requested, this hint is ignored.OpenGL profiles are described in detail in the OpenGL Reference Manual.
CONTEXT_ROBUSTNESS
: specifies the robustness strategy to be used by the context. This can be one ofNO_RESET_NOTIFICATION
orLOSE_CONTEXT_ON_RESET
, orNO_ROBUSTNESS
to not request a robustness strategy.CONTEXT_RELEASE_BEHAVIOR
: specifies the release behavior to be used by the context. Possible values are one ofANY_RELEASE_BEHAVIOR
,RELEASE_BEHAVIOR_FLUSH
orRELEASE_BEHAVIOR_NONE
. If the behavior isANY_RELEASE_BEHAVIOR
, the default behavior of the context creation API will be used. If the behavior isRELEASE_BEHAVIOR_FLUSH
, the pipeline will be flushed whenever the context is released from being the current one. If the behavior isRELEASE_BEHAVIOR_NONE
, the pipeline will not be flushed on release.Context release behaviors are described in detail by the GL_KHR_context_flush_control extension.
CONTEXT_NO_ERROR
: specifies whether errors should be generated by the context. Possible values areTRUE
andFALSE
. If enabled, situations that would have generated errors instead cause undefined behavior.The no error mode for OpenGL and OpenGL ES is described in detail by the GL_KHR_no_error extension.
- See Also:
-
CONTEXT_VERSION_MAJOR
public static final int CONTEXT_VERSION_MAJORContext related hints
CLIENT_API
: specifies which client API to create the context for. Possible values areOPENGL_API
,OPENGL_ES_API
andNO_API
. This is a hard constraint.CONTEXT_CREATION_API
: specifies which context creation API to use to create the context. Possible values areNATIVE_CONTEXT_API
,EGL_CONTEXT_API
andOSMESA_CONTEXT_API
. This is a hard constraint. If no client API is requested, this hint is ignored.An extension loader library that assumes it knows which API was used to create the current context may fail if you change this hint. This can be resolved by having it load functions via
getProcAddress
PREVIEW.Note
Wayland: The EGL API is the native context creation API, so this hint will have no effect.
X11: On some Linux systems, creating contexts via both the native and EGL APIs in a single process will cause the application to segfault. Stick to one API or the other on Linux for now.
OSMesa: As its name implies, an OpenGL context created with OSMesa does not update the window contents when its buffers are swapped. Use OpenGL functions or the OSMesa native access functionsgetOSMesaColorBuffer
PREVIEW andgetOSMesaDepthBuffer
PREVIEW to retrieve the framebuffer contents.CONTEXT_VERSION_MAJOR
andCONTEXT_VERSION_MINOR
: specify the client API version that the created context must be compatible with. The exact behavior of these hints depend on the requested client API.While there is no way to ask the driver for a context of the highest supported version, GLFW will attempt to provide this when you ask for a version 1.0 context, which is the default for these hints.
Do not confuse these hints with
VERSION_MAJOR
andVERSION_MINOR
, which provide the API version of the GLFW header.Note
OpenGL: These hints are not hard constraints, but creation will fail if the OpenGL version of the created context is less than the one requested. It is therefore perfectly safe to use the default of version 1.0 for legacy code and you will still get backwards-compatible contexts of version 3.0 and above when available.
OpenGL ES: These hints are not hard constraints, but creation will fail if the OpenGL ES version of the created context is less than the one requested. Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested, and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0, but OpenGL ES 2.0 is not backward compatible with 1.x.
macOS: 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 theOPENGL_FORWARD_COMPAT
andOPENGL_PROFILE
hints accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.OPENGL_FORWARD_COMPAT
: specifies whether the OpenGL context should be forward-compatible, i.e. one where all functionality deprecated in the requested version of OpenGL is removed. This must only be used if the requested OpenGL version is 3.0 or above. If OpenGL ES is requested, this hint is ignored.Forward-compatibility is described in detail in the OpenGL Reference Manual.
OPENGL_DEBUG_CONTEXT
: specifies whether the context should be created in debug mode, which may provide additional error and diagnostic reporting functionality. Possible values areTRUE
andFALSE
.Debug contexts for OpenGL and OpenGL ES are described in detail by the GL_KHR_debug extension.
OPENGL_PROFILE
: specifies which OpenGL profile to create the context for. Possible values are one ofOPENGL_CORE_PROFILE
orOPENGL_COMPAT_PROFILE
, orOPENGL_ANY_PROFILE
to not request a specific profile. If requesting an OpenGL version below 3.2,OPENGL_ANY_PROFILE
must be used. If OpenGL ES is requested, this hint is ignored.OpenGL profiles are described in detail in the OpenGL Reference Manual.
CONTEXT_ROBUSTNESS
: specifies the robustness strategy to be used by the context. This can be one ofNO_RESET_NOTIFICATION
orLOSE_CONTEXT_ON_RESET
, orNO_ROBUSTNESS
to not request a robustness strategy.CONTEXT_RELEASE_BEHAVIOR
: specifies the release behavior to be used by the context. Possible values are one ofANY_RELEASE_BEHAVIOR
,RELEASE_BEHAVIOR_FLUSH
orRELEASE_BEHAVIOR_NONE
. If the behavior isANY_RELEASE_BEHAVIOR
, the default behavior of the context creation API will be used. If the behavior isRELEASE_BEHAVIOR_FLUSH
, the pipeline will be flushed whenever the context is released from being the current one. If the behavior isRELEASE_BEHAVIOR_NONE
, the pipeline will not be flushed on release.Context release behaviors are described in detail by the GL_KHR_context_flush_control extension.
CONTEXT_NO_ERROR
: specifies whether errors should be generated by the context. Possible values areTRUE
andFALSE
. If enabled, situations that would have generated errors instead cause undefined behavior.The no error mode for OpenGL and OpenGL ES is described in detail by the GL_KHR_no_error extension.
- See Also:
-
CONTEXT_VERSION_MINOR
public static final int CONTEXT_VERSION_MINORContext related hints
CLIENT_API
: specifies which client API to create the context for. Possible values areOPENGL_API
,OPENGL_ES_API
andNO_API
. This is a hard constraint.CONTEXT_CREATION_API
: specifies which context creation API to use to create the context. Possible values areNATIVE_CONTEXT_API
,EGL_CONTEXT_API
andOSMESA_CONTEXT_API
. This is a hard constraint. If no client API is requested, this hint is ignored.An extension loader library that assumes it knows which API was used to create the current context may fail if you change this hint. This can be resolved by having it load functions via
getProcAddress
PREVIEW.Note
Wayland: The EGL API is the native context creation API, so this hint will have no effect.
X11: On some Linux systems, creating contexts via both the native and EGL APIs in a single process will cause the application to segfault. Stick to one API or the other on Linux for now.
OSMesa: As its name implies, an OpenGL context created with OSMesa does not update the window contents when its buffers are swapped. Use OpenGL functions or the OSMesa native access functionsgetOSMesaColorBuffer
PREVIEW andgetOSMesaDepthBuffer
PREVIEW to retrieve the framebuffer contents.CONTEXT_VERSION_MAJOR
andCONTEXT_VERSION_MINOR
: specify the client API version that the created context must be compatible with. The exact behavior of these hints depend on the requested client API.While there is no way to ask the driver for a context of the highest supported version, GLFW will attempt to provide this when you ask for a version 1.0 context, which is the default for these hints.
Do not confuse these hints with
VERSION_MAJOR
andVERSION_MINOR
, which provide the API version of the GLFW header.Note
OpenGL: These hints are not hard constraints, but creation will fail if the OpenGL version of the created context is less than the one requested. It is therefore perfectly safe to use the default of version 1.0 for legacy code and you will still get backwards-compatible contexts of version 3.0 and above when available.
OpenGL ES: These hints are not hard constraints, but creation will fail if the OpenGL ES version of the created context is less than the one requested. Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested, and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0, but OpenGL ES 2.0 is not backward compatible with 1.x.
macOS: 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 theOPENGL_FORWARD_COMPAT
andOPENGL_PROFILE
hints accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.OPENGL_FORWARD_COMPAT
: specifies whether the OpenGL context should be forward-compatible, i.e. one where all functionality deprecated in the requested version of OpenGL is removed. This must only be used if the requested OpenGL version is 3.0 or above. If OpenGL ES is requested, this hint is ignored.Forward-compatibility is described in detail in the OpenGL Reference Manual.
OPENGL_DEBUG_CONTEXT
: specifies whether the context should be created in debug mode, which may provide additional error and diagnostic reporting functionality. Possible values areTRUE
andFALSE
.Debug contexts for OpenGL and OpenGL ES are described in detail by the GL_KHR_debug extension.
OPENGL_PROFILE
: specifies which OpenGL profile to create the context for. Possible values are one ofOPENGL_CORE_PROFILE
orOPENGL_COMPAT_PROFILE
, orOPENGL_ANY_PROFILE
to not request a specific profile. If requesting an OpenGL version below 3.2,OPENGL_ANY_PROFILE
must be used. If OpenGL ES is requested, this hint is ignored.OpenGL profiles are described in detail in the OpenGL Reference Manual.
CONTEXT_ROBUSTNESS
: specifies the robustness strategy to be used by the context. This can be one ofNO_RESET_NOTIFICATION
orLOSE_CONTEXT_ON_RESET
, orNO_ROBUSTNESS
to not request a robustness strategy.CONTEXT_RELEASE_BEHAVIOR
: specifies the release behavior to be used by the context. Possible values are one ofANY_RELEASE_BEHAVIOR
,RELEASE_BEHAVIOR_FLUSH
orRELEASE_BEHAVIOR_NONE
. If the behavior isANY_RELEASE_BEHAVIOR
, the default behavior of the context creation API will be used. If the behavior isRELEASE_BEHAVIOR_FLUSH
, the pipeline will be flushed whenever the context is released from being the current one. If the behavior isRELEASE_BEHAVIOR_NONE
, the pipeline will not be flushed on release.Context release behaviors are described in detail by the GL_KHR_context_flush_control extension.
CONTEXT_NO_ERROR
: specifies whether errors should be generated by the context. Possible values areTRUE
andFALSE
. If enabled, situations that would have generated errors instead cause undefined behavior.The no error mode for OpenGL and OpenGL ES is described in detail by the GL_KHR_no_error extension.
- See Also:
-
CONTEXT_ROBUSTNESS
public static final int CONTEXT_ROBUSTNESSContext related hints
CLIENT_API
: specifies which client API to create the context for. Possible values areOPENGL_API
,OPENGL_ES_API
andNO_API
. This is a hard constraint.CONTEXT_CREATION_API
: specifies which context creation API to use to create the context. Possible values areNATIVE_CONTEXT_API
,EGL_CONTEXT_API
andOSMESA_CONTEXT_API
. This is a hard constraint. If no client API is requested, this hint is ignored.An extension loader library that assumes it knows which API was used to create the current context may fail if you change this hint. This can be resolved by having it load functions via
getProcAddress
PREVIEW.Note
Wayland: The EGL API is the native context creation API, so this hint will have no effect.
X11: On some Linux systems, creating contexts via both the native and EGL APIs in a single process will cause the application to segfault. Stick to one API or the other on Linux for now.
OSMesa: As its name implies, an OpenGL context created with OSMesa does not update the window contents when its buffers are swapped. Use OpenGL functions or the OSMesa native access functionsgetOSMesaColorBuffer
PREVIEW andgetOSMesaDepthBuffer
PREVIEW to retrieve the framebuffer contents.CONTEXT_VERSION_MAJOR
andCONTEXT_VERSION_MINOR
: specify the client API version that the created context must be compatible with. The exact behavior of these hints depend on the requested client API.While there is no way to ask the driver for a context of the highest supported version, GLFW will attempt to provide this when you ask for a version 1.0 context, which is the default for these hints.
Do not confuse these hints with
VERSION_MAJOR
andVERSION_MINOR
, which provide the API version of the GLFW header.Note
OpenGL: These hints are not hard constraints, but creation will fail if the OpenGL version of the created context is less than the one requested. It is therefore perfectly safe to use the default of version 1.0 for legacy code and you will still get backwards-compatible contexts of version 3.0 and above when available.
OpenGL ES: These hints are not hard constraints, but creation will fail if the OpenGL ES version of the created context is less than the one requested. Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested, and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0, but OpenGL ES 2.0 is not backward compatible with 1.x.
macOS: 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 theOPENGL_FORWARD_COMPAT
andOPENGL_PROFILE
hints accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.OPENGL_FORWARD_COMPAT
: specifies whether the OpenGL context should be forward-compatible, i.e. one where all functionality deprecated in the requested version of OpenGL is removed. This must only be used if the requested OpenGL version is 3.0 or above. If OpenGL ES is requested, this hint is ignored.Forward-compatibility is described in detail in the OpenGL Reference Manual.
OPENGL_DEBUG_CONTEXT
: specifies whether the context should be created in debug mode, which may provide additional error and diagnostic reporting functionality. Possible values areTRUE
andFALSE
.Debug contexts for OpenGL and OpenGL ES are described in detail by the GL_KHR_debug extension.
OPENGL_PROFILE
: specifies which OpenGL profile to create the context for. Possible values are one ofOPENGL_CORE_PROFILE
orOPENGL_COMPAT_PROFILE
, orOPENGL_ANY_PROFILE
to not request a specific profile. If requesting an OpenGL version below 3.2,OPENGL_ANY_PROFILE
must be used. If OpenGL ES is requested, this hint is ignored.OpenGL profiles are described in detail in the OpenGL Reference Manual.
CONTEXT_ROBUSTNESS
: specifies the robustness strategy to be used by the context. This can be one ofNO_RESET_NOTIFICATION
orLOSE_CONTEXT_ON_RESET
, orNO_ROBUSTNESS
to not request a robustness strategy.CONTEXT_RELEASE_BEHAVIOR
: specifies the release behavior to be used by the context. Possible values are one ofANY_RELEASE_BEHAVIOR
,RELEASE_BEHAVIOR_FLUSH
orRELEASE_BEHAVIOR_NONE
. If the behavior isANY_RELEASE_BEHAVIOR
, the default behavior of the context creation API will be used. If the behavior isRELEASE_BEHAVIOR_FLUSH
, the pipeline will be flushed whenever the context is released from being the current one. If the behavior isRELEASE_BEHAVIOR_NONE
, the pipeline will not be flushed on release.Context release behaviors are described in detail by the GL_KHR_context_flush_control extension.
CONTEXT_NO_ERROR
: specifies whether errors should be generated by the context. Possible values areTRUE
andFALSE
. If enabled, situations that would have generated errors instead cause undefined behavior.The no error mode for OpenGL and OpenGL ES is described in detail by the GL_KHR_no_error extension.
- See Also:
-
OPENGL_FORWARD_COMPAT
public static final int OPENGL_FORWARD_COMPATContext related hints
CLIENT_API
: specifies which client API to create the context for. Possible values areOPENGL_API
,OPENGL_ES_API
andNO_API
. This is a hard constraint.CONTEXT_CREATION_API
: specifies which context creation API to use to create the context. Possible values areNATIVE_CONTEXT_API
,EGL_CONTEXT_API
andOSMESA_CONTEXT_API
. This is a hard constraint. If no client API is requested, this hint is ignored.An extension loader library that assumes it knows which API was used to create the current context may fail if you change this hint. This can be resolved by having it load functions via
getProcAddress
PREVIEW.Note
Wayland: The EGL API is the native context creation API, so this hint will have no effect.
X11: On some Linux systems, creating contexts via both the native and EGL APIs in a single process will cause the application to segfault. Stick to one API or the other on Linux for now.
OSMesa: As its name implies, an OpenGL context created with OSMesa does not update the window contents when its buffers are swapped. Use OpenGL functions or the OSMesa native access functionsgetOSMesaColorBuffer
PREVIEW andgetOSMesaDepthBuffer
PREVIEW to retrieve the framebuffer contents.CONTEXT_VERSION_MAJOR
andCONTEXT_VERSION_MINOR
: specify the client API version that the created context must be compatible with. The exact behavior of these hints depend on the requested client API.While there is no way to ask the driver for a context of the highest supported version, GLFW will attempt to provide this when you ask for a version 1.0 context, which is the default for these hints.
Do not confuse these hints with
VERSION_MAJOR
andVERSION_MINOR
, which provide the API version of the GLFW header.Note
OpenGL: These hints are not hard constraints, but creation will fail if the OpenGL version of the created context is less than the one requested. It is therefore perfectly safe to use the default of version 1.0 for legacy code and you will still get backwards-compatible contexts of version 3.0 and above when available.
OpenGL ES: These hints are not hard constraints, but creation will fail if the OpenGL ES version of the created context is less than the one requested. Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested, and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0, but OpenGL ES 2.0 is not backward compatible with 1.x.
macOS: 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 theOPENGL_FORWARD_COMPAT
andOPENGL_PROFILE
hints accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.OPENGL_FORWARD_COMPAT
: specifies whether the OpenGL context should be forward-compatible, i.e. one where all functionality deprecated in the requested version of OpenGL is removed. This must only be used if the requested OpenGL version is 3.0 or above. If OpenGL ES is requested, this hint is ignored.Forward-compatibility is described in detail in the OpenGL Reference Manual.
OPENGL_DEBUG_CONTEXT
: specifies whether the context should be created in debug mode, which may provide additional error and diagnostic reporting functionality. Possible values areTRUE
andFALSE
.Debug contexts for OpenGL and OpenGL ES are described in detail by the GL_KHR_debug extension.
OPENGL_PROFILE
: specifies which OpenGL profile to create the context for. Possible values are one ofOPENGL_CORE_PROFILE
orOPENGL_COMPAT_PROFILE
, orOPENGL_ANY_PROFILE
to not request a specific profile. If requesting an OpenGL version below 3.2,OPENGL_ANY_PROFILE
must be used. If OpenGL ES is requested, this hint is ignored.OpenGL profiles are described in detail in the OpenGL Reference Manual.
CONTEXT_ROBUSTNESS
: specifies the robustness strategy to be used by the context. This can be one ofNO_RESET_NOTIFICATION
orLOSE_CONTEXT_ON_RESET
, orNO_ROBUSTNESS
to not request a robustness strategy.CONTEXT_RELEASE_BEHAVIOR
: specifies the release behavior to be used by the context. Possible values are one ofANY_RELEASE_BEHAVIOR
,RELEASE_BEHAVIOR_FLUSH
orRELEASE_BEHAVIOR_NONE
. If the behavior isANY_RELEASE_BEHAVIOR
, the default behavior of the context creation API will be used. If the behavior isRELEASE_BEHAVIOR_FLUSH
, the pipeline will be flushed whenever the context is released from being the current one. If the behavior isRELEASE_BEHAVIOR_NONE
, the pipeline will not be flushed on release.Context release behaviors are described in detail by the GL_KHR_context_flush_control extension.
CONTEXT_NO_ERROR
: specifies whether errors should be generated by the context. Possible values areTRUE
andFALSE
. If enabled, situations that would have generated errors instead cause undefined behavior.The no error mode for OpenGL and OpenGL ES is described in detail by the GL_KHR_no_error extension.
- See Also:
-
OPENGL_DEBUG_CONTEXT
public static final int OPENGL_DEBUG_CONTEXTContext related hints
CLIENT_API
: specifies which client API to create the context for. Possible values areOPENGL_API
,OPENGL_ES_API
andNO_API
. This is a hard constraint.CONTEXT_CREATION_API
: specifies which context creation API to use to create the context. Possible values areNATIVE_CONTEXT_API
,EGL_CONTEXT_API
andOSMESA_CONTEXT_API
. This is a hard constraint. If no client API is requested, this hint is ignored.An extension loader library that assumes it knows which API was used to create the current context may fail if you change this hint. This can be resolved by having it load functions via
getProcAddress
PREVIEW.Note
Wayland: The EGL API is the native context creation API, so this hint will have no effect.
X11: On some Linux systems, creating contexts via both the native and EGL APIs in a single process will cause the application to segfault. Stick to one API or the other on Linux for now.
OSMesa: As its name implies, an OpenGL context created with OSMesa does not update the window contents when its buffers are swapped. Use OpenGL functions or the OSMesa native access functionsgetOSMesaColorBuffer
PREVIEW andgetOSMesaDepthBuffer
PREVIEW to retrieve the framebuffer contents.CONTEXT_VERSION_MAJOR
andCONTEXT_VERSION_MINOR
: specify the client API version that the created context must be compatible with. The exact behavior of these hints depend on the requested client API.While there is no way to ask the driver for a context of the highest supported version, GLFW will attempt to provide this when you ask for a version 1.0 context, which is the default for these hints.
Do not confuse these hints with
VERSION_MAJOR
andVERSION_MINOR
, which provide the API version of the GLFW header.Note
OpenGL: These hints are not hard constraints, but creation will fail if the OpenGL version of the created context is less than the one requested. It is therefore perfectly safe to use the default of version 1.0 for legacy code and you will still get backwards-compatible contexts of version 3.0 and above when available.
OpenGL ES: These hints are not hard constraints, but creation will fail if the OpenGL ES version of the created context is less than the one requested. Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested, and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0, but OpenGL ES 2.0 is not backward compatible with 1.x.
macOS: 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 theOPENGL_FORWARD_COMPAT
andOPENGL_PROFILE
hints accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.OPENGL_FORWARD_COMPAT
: specifies whether the OpenGL context should be forward-compatible, i.e. one where all functionality deprecated in the requested version of OpenGL is removed. This must only be used if the requested OpenGL version is 3.0 or above. If OpenGL ES is requested, this hint is ignored.Forward-compatibility is described in detail in the OpenGL Reference Manual.
OPENGL_DEBUG_CONTEXT
: specifies whether the context should be created in debug mode, which may provide additional error and diagnostic reporting functionality. Possible values areTRUE
andFALSE
.Debug contexts for OpenGL and OpenGL ES are described in detail by the GL_KHR_debug extension.
OPENGL_PROFILE
: specifies which OpenGL profile to create the context for. Possible values are one ofOPENGL_CORE_PROFILE
orOPENGL_COMPAT_PROFILE
, orOPENGL_ANY_PROFILE
to not request a specific profile. If requesting an OpenGL version below 3.2,OPENGL_ANY_PROFILE
must be used. If OpenGL ES is requested, this hint is ignored.OpenGL profiles are described in detail in the OpenGL Reference Manual.
CONTEXT_ROBUSTNESS
: specifies the robustness strategy to be used by the context. This can be one ofNO_RESET_NOTIFICATION
orLOSE_CONTEXT_ON_RESET
, orNO_ROBUSTNESS
to not request a robustness strategy.CONTEXT_RELEASE_BEHAVIOR
: specifies the release behavior to be used by the context. Possible values are one ofANY_RELEASE_BEHAVIOR
,RELEASE_BEHAVIOR_FLUSH
orRELEASE_BEHAVIOR_NONE
. If the behavior isANY_RELEASE_BEHAVIOR
, the default behavior of the context creation API will be used. If the behavior isRELEASE_BEHAVIOR_FLUSH
, the pipeline will be flushed whenever the context is released from being the current one. If the behavior isRELEASE_BEHAVIOR_NONE
, the pipeline will not be flushed on release.Context release behaviors are described in detail by the GL_KHR_context_flush_control extension.
CONTEXT_NO_ERROR
: specifies whether errors should be generated by the context. Possible values areTRUE
andFALSE
. If enabled, situations that would have generated errors instead cause undefined behavior.The no error mode for OpenGL and OpenGL ES is described in detail by the GL_KHR_no_error extension.
- See Also:
-
OPENGL_PROFILE
public static final int OPENGL_PROFILEContext related hints
CLIENT_API
: specifies which client API to create the context for. Possible values areOPENGL_API
,OPENGL_ES_API
andNO_API
. This is a hard constraint.CONTEXT_CREATION_API
: specifies which context creation API to use to create the context. Possible values areNATIVE_CONTEXT_API
,EGL_CONTEXT_API
andOSMESA_CONTEXT_API
. This is a hard constraint. If no client API is requested, this hint is ignored.An extension loader library that assumes it knows which API was used to create the current context may fail if you change this hint. This can be resolved by having it load functions via
getProcAddress
PREVIEW.Note
Wayland: The EGL API is the native context creation API, so this hint will have no effect.
X11: On some Linux systems, creating contexts via both the native and EGL APIs in a single process will cause the application to segfault. Stick to one API or the other on Linux for now.
OSMesa: As its name implies, an OpenGL context created with OSMesa does not update the window contents when its buffers are swapped. Use OpenGL functions or the OSMesa native access functionsgetOSMesaColorBuffer
PREVIEW andgetOSMesaDepthBuffer
PREVIEW to retrieve the framebuffer contents.CONTEXT_VERSION_MAJOR
andCONTEXT_VERSION_MINOR
: specify the client API version that the created context must be compatible with. The exact behavior of these hints depend on the requested client API.While there is no way to ask the driver for a context of the highest supported version, GLFW will attempt to provide this when you ask for a version 1.0 context, which is the default for these hints.
Do not confuse these hints with
VERSION_MAJOR
andVERSION_MINOR
, which provide the API version of the GLFW header.Note
OpenGL: These hints are not hard constraints, but creation will fail if the OpenGL version of the created context is less than the one requested. It is therefore perfectly safe to use the default of version 1.0 for legacy code and you will still get backwards-compatible contexts of version 3.0 and above when available.
OpenGL ES: These hints are not hard constraints, but creation will fail if the OpenGL ES version of the created context is less than the one requested. Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested, and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0, but OpenGL ES 2.0 is not backward compatible with 1.x.
macOS: 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 theOPENGL_FORWARD_COMPAT
andOPENGL_PROFILE
hints accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.OPENGL_FORWARD_COMPAT
: specifies whether the OpenGL context should be forward-compatible, i.e. one where all functionality deprecated in the requested version of OpenGL is removed. This must only be used if the requested OpenGL version is 3.0 or above. If OpenGL ES is requested, this hint is ignored.Forward-compatibility is described in detail in the OpenGL Reference Manual.
OPENGL_DEBUG_CONTEXT
: specifies whether the context should be created in debug mode, which may provide additional error and diagnostic reporting functionality. Possible values areTRUE
andFALSE
.Debug contexts for OpenGL and OpenGL ES are described in detail by the GL_KHR_debug extension.
OPENGL_PROFILE
: specifies which OpenGL profile to create the context for. Possible values are one ofOPENGL_CORE_PROFILE
orOPENGL_COMPAT_PROFILE
, orOPENGL_ANY_PROFILE
to not request a specific profile. If requesting an OpenGL version below 3.2,OPENGL_ANY_PROFILE
must be used. If OpenGL ES is requested, this hint is ignored.OpenGL profiles are described in detail in the OpenGL Reference Manual.
CONTEXT_ROBUSTNESS
: specifies the robustness strategy to be used by the context. This can be one ofNO_RESET_NOTIFICATION
orLOSE_CONTEXT_ON_RESET
, orNO_ROBUSTNESS
to not request a robustness strategy.CONTEXT_RELEASE_BEHAVIOR
: specifies the release behavior to be used by the context. Possible values are one ofANY_RELEASE_BEHAVIOR
,RELEASE_BEHAVIOR_FLUSH
orRELEASE_BEHAVIOR_NONE
. If the behavior isANY_RELEASE_BEHAVIOR
, the default behavior of the context creation API will be used. If the behavior isRELEASE_BEHAVIOR_FLUSH
, the pipeline will be flushed whenever the context is released from being the current one. If the behavior isRELEASE_BEHAVIOR_NONE
, the pipeline will not be flushed on release.Context release behaviors are described in detail by the GL_KHR_context_flush_control extension.
CONTEXT_NO_ERROR
: specifies whether errors should be generated by the context. Possible values areTRUE
andFALSE
. If enabled, situations that would have generated errors instead cause undefined behavior.The no error mode for OpenGL and OpenGL ES is described in detail by the GL_KHR_no_error extension.
- See Also:
-
CONTEXT_RELEASE_BEHAVIOR
public static final int CONTEXT_RELEASE_BEHAVIORContext related hints
CLIENT_API
: specifies which client API to create the context for. Possible values areOPENGL_API
,OPENGL_ES_API
andNO_API
. This is a hard constraint.CONTEXT_CREATION_API
: specifies which context creation API to use to create the context. Possible values areNATIVE_CONTEXT_API
,EGL_CONTEXT_API
andOSMESA_CONTEXT_API
. This is a hard constraint. If no client API is requested, this hint is ignored.An extension loader library that assumes it knows which API was used to create the current context may fail if you change this hint. This can be resolved by having it load functions via
getProcAddress
PREVIEW.Note
Wayland: The EGL API is the native context creation API, so this hint will have no effect.
X11: On some Linux systems, creating contexts via both the native and EGL APIs in a single process will cause the application to segfault. Stick to one API or the other on Linux for now.
OSMesa: As its name implies, an OpenGL context created with OSMesa does not update the window contents when its buffers are swapped. Use OpenGL functions or the OSMesa native access functionsgetOSMesaColorBuffer
PREVIEW andgetOSMesaDepthBuffer
PREVIEW to retrieve the framebuffer contents.CONTEXT_VERSION_MAJOR
andCONTEXT_VERSION_MINOR
: specify the client API version that the created context must be compatible with. The exact behavior of these hints depend on the requested client API.While there is no way to ask the driver for a context of the highest supported version, GLFW will attempt to provide this when you ask for a version 1.0 context, which is the default for these hints.
Do not confuse these hints with
VERSION_MAJOR
andVERSION_MINOR
, which provide the API version of the GLFW header.Note
OpenGL: These hints are not hard constraints, but creation will fail if the OpenGL version of the created context is less than the one requested. It is therefore perfectly safe to use the default of version 1.0 for legacy code and you will still get backwards-compatible contexts of version 3.0 and above when available.
OpenGL ES: These hints are not hard constraints, but creation will fail if the OpenGL ES version of the created context is less than the one requested. Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested, and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0, but OpenGL ES 2.0 is not backward compatible with 1.x.
macOS: 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 theOPENGL_FORWARD_COMPAT
andOPENGL_PROFILE
hints accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.OPENGL_FORWARD_COMPAT
: specifies whether the OpenGL context should be forward-compatible, i.e. one where all functionality deprecated in the requested version of OpenGL is removed. This must only be used if the requested OpenGL version is 3.0 or above. If OpenGL ES is requested, this hint is ignored.Forward-compatibility is described in detail in the OpenGL Reference Manual.
OPENGL_DEBUG_CONTEXT
: specifies whether the context should be created in debug mode, which may provide additional error and diagnostic reporting functionality. Possible values areTRUE
andFALSE
.Debug contexts for OpenGL and OpenGL ES are described in detail by the GL_KHR_debug extension.
OPENGL_PROFILE
: specifies which OpenGL profile to create the context for. Possible values are one ofOPENGL_CORE_PROFILE
orOPENGL_COMPAT_PROFILE
, orOPENGL_ANY_PROFILE
to not request a specific profile. If requesting an OpenGL version below 3.2,OPENGL_ANY_PROFILE
must be used. If OpenGL ES is requested, this hint is ignored.OpenGL profiles are described in detail in the OpenGL Reference Manual.
CONTEXT_ROBUSTNESS
: specifies the robustness strategy to be used by the context. This can be one ofNO_RESET_NOTIFICATION
orLOSE_CONTEXT_ON_RESET
, orNO_ROBUSTNESS
to not request a robustness strategy.CONTEXT_RELEASE_BEHAVIOR
: specifies the release behavior to be used by the context. Possible values are one ofANY_RELEASE_BEHAVIOR
,RELEASE_BEHAVIOR_FLUSH
orRELEASE_BEHAVIOR_NONE
. If the behavior isANY_RELEASE_BEHAVIOR
, the default behavior of the context creation API will be used. If the behavior isRELEASE_BEHAVIOR_FLUSH
, the pipeline will be flushed whenever the context is released from being the current one. If the behavior isRELEASE_BEHAVIOR_NONE
, the pipeline will not be flushed on release.Context release behaviors are described in detail by the GL_KHR_context_flush_control extension.
CONTEXT_NO_ERROR
: specifies whether errors should be generated by the context. Possible values areTRUE
andFALSE
. If enabled, situations that would have generated errors instead cause undefined behavior.The no error mode for OpenGL and OpenGL ES is described in detail by the GL_KHR_no_error extension.
- See Also:
-
CONTEXT_NO_ERROR
public static final int CONTEXT_NO_ERRORContext related hints
CLIENT_API
: specifies which client API to create the context for. Possible values areOPENGL_API
,OPENGL_ES_API
andNO_API
. This is a hard constraint.CONTEXT_CREATION_API
: specifies which context creation API to use to create the context. Possible values areNATIVE_CONTEXT_API
,EGL_CONTEXT_API
andOSMESA_CONTEXT_API
. This is a hard constraint. If no client API is requested, this hint is ignored.An extension loader library that assumes it knows which API was used to create the current context may fail if you change this hint. This can be resolved by having it load functions via
getProcAddress
PREVIEW.Note
Wayland: The EGL API is the native context creation API, so this hint will have no effect.
X11: On some Linux systems, creating contexts via both the native and EGL APIs in a single process will cause the application to segfault. Stick to one API or the other on Linux for now.
OSMesa: As its name implies, an OpenGL context created with OSMesa does not update the window contents when its buffers are swapped. Use OpenGL functions or the OSMesa native access functionsgetOSMesaColorBuffer
PREVIEW andgetOSMesaDepthBuffer
PREVIEW to retrieve the framebuffer contents.CONTEXT_VERSION_MAJOR
andCONTEXT_VERSION_MINOR
: specify the client API version that the created context must be compatible with. The exact behavior of these hints depend on the requested client API.While there is no way to ask the driver for a context of the highest supported version, GLFW will attempt to provide this when you ask for a version 1.0 context, which is the default for these hints.
Do not confuse these hints with
VERSION_MAJOR
andVERSION_MINOR
, which provide the API version of the GLFW header.Note
OpenGL: These hints are not hard constraints, but creation will fail if the OpenGL version of the created context is less than the one requested. It is therefore perfectly safe to use the default of version 1.0 for legacy code and you will still get backwards-compatible contexts of version 3.0 and above when available.
OpenGL ES: These hints are not hard constraints, but creation will fail if the OpenGL ES version of the created context is less than the one requested. Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested, and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0, but OpenGL ES 2.0 is not backward compatible with 1.x.
macOS: 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 theOPENGL_FORWARD_COMPAT
andOPENGL_PROFILE
hints accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.OPENGL_FORWARD_COMPAT
: specifies whether the OpenGL context should be forward-compatible, i.e. one where all functionality deprecated in the requested version of OpenGL is removed. This must only be used if the requested OpenGL version is 3.0 or above. If OpenGL ES is requested, this hint is ignored.Forward-compatibility is described in detail in the OpenGL Reference Manual.
OPENGL_DEBUG_CONTEXT
: specifies whether the context should be created in debug mode, which may provide additional error and diagnostic reporting functionality. Possible values areTRUE
andFALSE
.Debug contexts for OpenGL and OpenGL ES are described in detail by the GL_KHR_debug extension.
OPENGL_PROFILE
: specifies which OpenGL profile to create the context for. Possible values are one ofOPENGL_CORE_PROFILE
orOPENGL_COMPAT_PROFILE
, orOPENGL_ANY_PROFILE
to not request a specific profile. If requesting an OpenGL version below 3.2,OPENGL_ANY_PROFILE
must be used. If OpenGL ES is requested, this hint is ignored.OpenGL profiles are described in detail in the OpenGL Reference Manual.
CONTEXT_ROBUSTNESS
: specifies the robustness strategy to be used by the context. This can be one ofNO_RESET_NOTIFICATION
orLOSE_CONTEXT_ON_RESET
, orNO_ROBUSTNESS
to not request a robustness strategy.CONTEXT_RELEASE_BEHAVIOR
: specifies the release behavior to be used by the context. Possible values are one ofANY_RELEASE_BEHAVIOR
,RELEASE_BEHAVIOR_FLUSH
orRELEASE_BEHAVIOR_NONE
. If the behavior isANY_RELEASE_BEHAVIOR
, the default behavior of the context creation API will be used. If the behavior isRELEASE_BEHAVIOR_FLUSH
, the pipeline will be flushed whenever the context is released from being the current one. If the behavior isRELEASE_BEHAVIOR_NONE
, the pipeline will not be flushed on release.Context release behaviors are described in detail by the GL_KHR_context_flush_control extension.
CONTEXT_NO_ERROR
: specifies whether errors should be generated by the context. Possible values areTRUE
andFALSE
. If enabled, situations that would have generated errors instead cause undefined behavior.The no error mode for OpenGL and OpenGL ES is described in detail by the GL_KHR_no_error extension.
- See Also:
-
CONTEXT_CREATION_API
public static final int CONTEXT_CREATION_APIContext related hints
CLIENT_API
: specifies which client API to create the context for. Possible values areOPENGL_API
,OPENGL_ES_API
andNO_API
. This is a hard constraint.CONTEXT_CREATION_API
: specifies which context creation API to use to create the context. Possible values areNATIVE_CONTEXT_API
,EGL_CONTEXT_API
andOSMESA_CONTEXT_API
. This is a hard constraint. If no client API is requested, this hint is ignored.An extension loader library that assumes it knows which API was used to create the current context may fail if you change this hint. This can be resolved by having it load functions via
getProcAddress
PREVIEW.Note
Wayland: The EGL API is the native context creation API, so this hint will have no effect.
X11: On some Linux systems, creating contexts via both the native and EGL APIs in a single process will cause the application to segfault. Stick to one API or the other on Linux for now.
OSMesa: As its name implies, an OpenGL context created with OSMesa does not update the window contents when its buffers are swapped. Use OpenGL functions or the OSMesa native access functionsgetOSMesaColorBuffer
PREVIEW andgetOSMesaDepthBuffer
PREVIEW to retrieve the framebuffer contents.CONTEXT_VERSION_MAJOR
andCONTEXT_VERSION_MINOR
: specify the client API version that the created context must be compatible with. The exact behavior of these hints depend on the requested client API.While there is no way to ask the driver for a context of the highest supported version, GLFW will attempt to provide this when you ask for a version 1.0 context, which is the default for these hints.
Do not confuse these hints with
VERSION_MAJOR
andVERSION_MINOR
, which provide the API version of the GLFW header.Note
OpenGL: These hints are not hard constraints, but creation will fail if the OpenGL version of the created context is less than the one requested. It is therefore perfectly safe to use the default of version 1.0 for legacy code and you will still get backwards-compatible contexts of version 3.0 and above when available.
OpenGL ES: These hints are not hard constraints, but creation will fail if the OpenGL ES version of the created context is less than the one requested. Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested, and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0, but OpenGL ES 2.0 is not backward compatible with 1.x.
macOS: 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 theOPENGL_FORWARD_COMPAT
andOPENGL_PROFILE
hints accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.OPENGL_FORWARD_COMPAT
: specifies whether the OpenGL context should be forward-compatible, i.e. one where all functionality deprecated in the requested version of OpenGL is removed. This must only be used if the requested OpenGL version is 3.0 or above. If OpenGL ES is requested, this hint is ignored.Forward-compatibility is described in detail in the OpenGL Reference Manual.
OPENGL_DEBUG_CONTEXT
: specifies whether the context should be created in debug mode, which may provide additional error and diagnostic reporting functionality. Possible values areTRUE
andFALSE
.Debug contexts for OpenGL and OpenGL ES are described in detail by the GL_KHR_debug extension.
OPENGL_PROFILE
: specifies which OpenGL profile to create the context for. Possible values are one ofOPENGL_CORE_PROFILE
orOPENGL_COMPAT_PROFILE
, orOPENGL_ANY_PROFILE
to not request a specific profile. If requesting an OpenGL version below 3.2,OPENGL_ANY_PROFILE
must be used. If OpenGL ES is requested, this hint is ignored.OpenGL profiles are described in detail in the OpenGL Reference Manual.
CONTEXT_ROBUSTNESS
: specifies the robustness strategy to be used by the context. This can be one ofNO_RESET_NOTIFICATION
orLOSE_CONTEXT_ON_RESET
, orNO_ROBUSTNESS
to not request a robustness strategy.CONTEXT_RELEASE_BEHAVIOR
: specifies the release behavior to be used by the context. Possible values are one ofANY_RELEASE_BEHAVIOR
,RELEASE_BEHAVIOR_FLUSH
orRELEASE_BEHAVIOR_NONE
. If the behavior isANY_RELEASE_BEHAVIOR
, the default behavior of the context creation API will be used. If the behavior isRELEASE_BEHAVIOR_FLUSH
, the pipeline will be flushed whenever the context is released from being the current one. If the behavior isRELEASE_BEHAVIOR_NONE
, the pipeline will not be flushed on release.Context release behaviors are described in detail by the GL_KHR_context_flush_control extension.
CONTEXT_NO_ERROR
: specifies whether errors should be generated by the context. Possible values areTRUE
andFALSE
. If enabled, situations that would have generated errors instead cause undefined behavior.The no error mode for OpenGL and OpenGL ES is described in detail by the GL_KHR_no_error extension.
- See Also:
-
CONTEXT_REVISION
public static final int CONTEXT_REVISIONCONTEXT_VERSION_MAJOR
,CONTEXT_VERSION_MINOR
andCONTEXT_REVISION
indicate the client API version of the window's context.- See Also:
-
COCOA_RETINA_FRAMEBUFFER
public static final int COCOA_RETINA_FRAMEBUFFERmacOS specific window hints
COCOA_RETINA_FRAMEBUFFER
: specifies whether to use full resolution framebuffers on Retina displays. Possible values areTRUE
andFALSE
. This is ignored on other platforms.COCOA_FRAME_NAME
: specifies the UTF-8 encoded name to use for autosaving the window frame, or if empty disables frame autosaving for the window. This is ignored on other platforms. This is set withwindowHintString(int, java.lang.String)
.COCOA_GRAPHICS_SWITCHING
: specifies whether to in Automatic Graphics Switching, i.e. to allow the system to choose the integrated GPU for the OpenGL context and move it between GPUs if necessary or whether to force it to always run on the discrete GPU. This only affects systems with both integrated and discrete GPUs. Possible values areTRUE
andFALSE
. This is ignored on other platforms.Simpler programs and tools may want to enable this to save power, while games and other applications performing advanced rendering will want to leave it disabled.
A bundled application that wishes to participate in Automatic Graphics Switching should also declare this in its
Info.plist
by setting theNSSupportsAutomaticGraphicsSwitching
key totrue
.
- See Also:
-
COCOA_FRAME_NAME
public static final int COCOA_FRAME_NAMEmacOS specific window hints
COCOA_RETINA_FRAMEBUFFER
: specifies whether to use full resolution framebuffers on Retina displays. Possible values areTRUE
andFALSE
. This is ignored on other platforms.COCOA_FRAME_NAME
: specifies the UTF-8 encoded name to use for autosaving the window frame, or if empty disables frame autosaving for the window. This is ignored on other platforms. This is set withwindowHintString(int, java.lang.String)
.COCOA_GRAPHICS_SWITCHING
: specifies whether to in Automatic Graphics Switching, i.e. to allow the system to choose the integrated GPU for the OpenGL context and move it between GPUs if necessary or whether to force it to always run on the discrete GPU. This only affects systems with both integrated and discrete GPUs. Possible values areTRUE
andFALSE
. This is ignored on other platforms.Simpler programs and tools may want to enable this to save power, while games and other applications performing advanced rendering will want to leave it disabled.
A bundled application that wishes to participate in Automatic Graphics Switching should also declare this in its
Info.plist
by setting theNSSupportsAutomaticGraphicsSwitching
key totrue
.
- See Also:
-
COCOA_GRAPHICS_SWITCHING
public static final int COCOA_GRAPHICS_SWITCHINGmacOS specific window hints
COCOA_RETINA_FRAMEBUFFER
: specifies whether to use full resolution framebuffers on Retina displays. Possible values areTRUE
andFALSE
. This is ignored on other platforms.COCOA_FRAME_NAME
: specifies the UTF-8 encoded name to use for autosaving the window frame, or if empty disables frame autosaving for the window. This is ignored on other platforms. This is set withwindowHintString(int, java.lang.String)
.COCOA_GRAPHICS_SWITCHING
: specifies whether to in Automatic Graphics Switching, i.e. to allow the system to choose the integrated GPU for the OpenGL context and move it between GPUs if necessary or whether to force it to always run on the discrete GPU. This only affects systems with both integrated and discrete GPUs. Possible values areTRUE
andFALSE
. This is ignored on other platforms.Simpler programs and tools may want to enable this to save power, while games and other applications performing advanced rendering will want to leave it disabled.
A bundled application that wishes to participate in Automatic Graphics Switching should also declare this in its
Info.plist
by setting theNSSupportsAutomaticGraphicsSwitching
key totrue
.
- See Also:
-
X11_CLASS_NAME
public static final int X11_CLASS_NAMEX11 specific window hints
X11_CLASS_NAME
andX11_INSTANCE_NAME
specifies the desired ASCII encoded class and instance parts of the ICCCMWM_CLASS
window property. These are set withwindowHintString(int, java.lang.String)
.- See Also:
-
X11_INSTANCE_NAME
public static final int X11_INSTANCE_NAMEX11 specific window hints
X11_CLASS_NAME
andX11_INSTANCE_NAME
specifies the desired ASCII encoded class and instance parts of the ICCCMWM_CLASS
window property. These are set withwindowHintString(int, java.lang.String)
.- See Also:
-
NO_API
public static final int NO_APIvalue for CLIENT_API- See Also:
-
OPENGL_API
public static final int OPENGL_APIvalue for CLIENT_API- See Also:
-
OPENGL_ES_API
public static final int OPENGL_ES_APIvalue for CLIENT_API- See Also:
-
NO_ROBUSTNESS
public static final int NO_ROBUSTNESSvalue for CONTEXT_ROBUSTNESS- See Also:
-
NO_RESET_NOTIFICATION
public static final int NO_RESET_NOTIFICATIONvalue for CONTEXT_ROBUSTNESS- See Also:
-
LOSE_CONTEXT_ON_RESET
public static final int LOSE_CONTEXT_ON_RESETvalue for CONTEXT_ROBUSTNESS- See Also:
-
OPENGL_ANY_PROFILE
public static final int OPENGL_ANY_PROFILEvalue for OPENGL_PROFILE- See Also:
-
OPENGL_CORE_PROFILE
public static final int OPENGL_CORE_PROFILEvalue for OPENGL_PROFILE- See Also:
-
OPENGL_COMPAT_PROFILE
public static final int OPENGL_COMPAT_PROFILEvalue for OPENGL_PROFILE- See Also:
-
CURSOR
public static final int CURSOR- See Also:
-
STICKY_KEYS
public static final int STICKY_KEYS- See Also:
-
STICKY_MOUSE_BUTTONS
public static final int STICKY_MOUSE_BUTTONS- See Also:
-
LOCK_KEY_MODS
public static final int LOCK_KEY_MODS- See Also:
-
RAW_MOUSE_MOTION
public static final int RAW_MOUSE_MOTION- See Also:
-
CURSOR_NORMAL
public static final int CURSOR_NORMALCursor mode
TheCURSOR
input mode provides several cursor modes for special forms of mouse motion input. By default, the cursor mode isCURSOR_NORMAL
, meaning the regular arrow cursor (or another cursor set withsetCursor(java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment)
PREVIEW) is used and cursor motion is not limited.If you wish to implement mouse motion based camera controls or other input schemes that require unlimited mouse movement, set the cursor mode to
CURSOR_DISABLED
.GLFW.setInputMode(window, GLFW.CURSOR, GLFW.CURSOR_DISABLED);
Note
You should not implement your own version of this functionality using other features of GLFW. It is not supported and will not work as robustly asCURSOR_DISABLED
.If you only wish the cursor to become hidden when it is over a window but still want it to behave normally, set the cursor mode to
CURSOR_HIDDEN
.GLFW.setInputMode(window, GLFW.CURSOR, GLFW.CURSOR_HIDDEN);
To exit out of either of these special modes, restore the
CURSOR_NORMAL
cursor mode.GLFW.setInputMode(window, GLFW.CURSOR, GLFW.CURSOR_NORMAL);
- See Also:
-
CURSOR_HIDDEN
public static final int CURSOR_HIDDENCursor mode
TheCURSOR
input mode provides several cursor modes for special forms of mouse motion input. By default, the cursor mode isCURSOR_NORMAL
, meaning the regular arrow cursor (or another cursor set withsetCursor(java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment)
PREVIEW) is used and cursor motion is not limited.If you wish to implement mouse motion based camera controls or other input schemes that require unlimited mouse movement, set the cursor mode to
CURSOR_DISABLED
.GLFW.setInputMode(window, GLFW.CURSOR, GLFW.CURSOR_DISABLED);
Note
You should not implement your own version of this functionality using other features of GLFW. It is not supported and will not work as robustly asCURSOR_DISABLED
.If you only wish the cursor to become hidden when it is over a window but still want it to behave normally, set the cursor mode to
CURSOR_HIDDEN
.GLFW.setInputMode(window, GLFW.CURSOR, GLFW.CURSOR_HIDDEN);
To exit out of either of these special modes, restore the
CURSOR_NORMAL
cursor mode.GLFW.setInputMode(window, GLFW.CURSOR, GLFW.CURSOR_NORMAL);
- See Also:
-
CURSOR_DISABLED
public static final int CURSOR_DISABLEDCursor mode
TheCURSOR
input mode provides several cursor modes for special forms of mouse motion input. By default, the cursor mode isCURSOR_NORMAL
, meaning the regular arrow cursor (or another cursor set withsetCursor(java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment)
PREVIEW) is used and cursor motion is not limited.If you wish to implement mouse motion based camera controls or other input schemes that require unlimited mouse movement, set the cursor mode to
CURSOR_DISABLED
.GLFW.setInputMode(window, GLFW.CURSOR, GLFW.CURSOR_DISABLED);
Note
You should not implement your own version of this functionality using other features of GLFW. It is not supported and will not work as robustly asCURSOR_DISABLED
.If you only wish the cursor to become hidden when it is over a window but still want it to behave normally, set the cursor mode to
CURSOR_HIDDEN
.GLFW.setInputMode(window, GLFW.CURSOR, GLFW.CURSOR_HIDDEN);
To exit out of either of these special modes, restore the
CURSOR_NORMAL
cursor mode.GLFW.setInputMode(window, GLFW.CURSOR, GLFW.CURSOR_NORMAL);
- See Also:
-
ANY_RELEASE_BEHAVIOR
public static final int ANY_RELEASE_BEHAVIOR- See Also:
-
RELEASE_BEHAVIOR_FLUSH
public static final int RELEASE_BEHAVIOR_FLUSH- See Also:
-
RELEASE_BEHAVIOR_NONE
public static final int RELEASE_BEHAVIOR_NONE- See Also:
-
NATIVE_CONTEXT_API
public static final int NATIVE_CONTEXT_API- See Also:
-
EGL_CONTEXT_API
public static final int EGL_CONTEXT_API- See Also:
-
OSMESA_CONTEXT_API
public static final int OSMESA_CONTEXT_API- See Also:
-
ARROW_CURSOR
public static final int ARROW_CURSORThe regular arrow cursor.- See Also:
-
IBEAM_CURSOR
public static final int IBEAM_CURSORThe text input I-beam cursor shape.- See Also:
-
CROSSHAIR_CURSOR
public static final int CROSSHAIR_CURSORThe crosshair shape.- See Also:
-
HAND_CURSOR
public static final int HAND_CURSORThe hand shape.- See Also:
-
HRESIZE_CURSOR
public static final int HRESIZE_CURSORThe horizontal resize arrow shape.- See Also:
-
VRESIZE_CURSOR
public static final int VRESIZE_CURSORThe vertical resize arrow shape.- See Also:
-
CONNECTED
public static final int CONNECTED- See Also:
-
DISCONNECTED
public static final int DISCONNECTED- See Also:
-
JOYSTICK_HAT_BUTTONS
public static final int JOYSTICK_HAT_BUTTONSJOYSTICK_HAT_BUTTONS
specifies whether to also expose joystick hats as buttons, for compatibility with earlier versions of GLFW that did not havegetJoystickHats(int)
. Possible values areTRUE
andFALSE
.- See Also:
-
COCOA_CHDIR_RESOURCES
public static final int COCOA_CHDIR_RESOURCESmacOS specific init hints
COCOA_CHDIR_RESOURCES
: specifies whether to set the current directory to the application to theContents/Resources
subdirectory of the application's bundle, if present. Set this withinitHint(int, int)
.COCOA_MENUBAR
: specifies whether to create a basic menu bar, either from a nib or manually, when the first window is created, which is when AppKit is initialized. Set this withinitHint(int, int)
.
- See Also:
-
COCOA_MENUBAR
public static final int COCOA_MENUBARmacOS specific init hints
COCOA_CHDIR_RESOURCES
: specifies whether to set the current directory to the application to theContents/Resources
subdirectory of the application's bundle, if present. Set this withinitHint(int, int)
.COCOA_MENUBAR
: specifies whether to create a basic menu bar, either from a nib or manually, when the first window is created, which is when AppKit is initialized. Set this withinitHint(int, int)
.
- See Also:
-
DONT_CARE
public static final int DONT_CAREDon't care value.- See Also:
-
-
Method Details
-
getErrorString
Converts the given error code to a readable string.- Parameters:
errorCode
- the error code.- Returns:
- the error string.
-
init
public static boolean init()Initializes the GLFW library.This function initializes the GLFW library. Before most GLFW functions can be used, GLFW must be initialized, and before an application terminates GLFW should be terminated in order to free any resources allocated during or after initialization.
If this function fails, it calls
terminate()
before returning. If it succeeds, you should callterminate()
before the application exits.Additional calls to this function after successful initialization but before termination will return
true
immediately.- Returns:
true
if successful, orfalse
if an error occurred.- See Also:
- Errors:
- Possible errors include
PLATFORM_ERROR
. - Remarks:
- macOS: This function will change the current directory of the
application to the
Contents/Resources
subdirectory of the application's bundle, if present. This can be disabled with theCOCOA_CHDIR_RESOURCES
init hint.
X11: This function will set theLC_CTYPE
category of the application locale according to the current environment if that category is still "C". This is because the "C" locale breaks Unicode text input. - Thread safety:
- This function must only be called from the main thread.
-
terminate
public static void terminate()Terminates the GLFW library.This function destroys all remaining windows and cursors, restores any modified gamma ramps and frees any other allocated resources. Once this function is called, you must again call
init()
successfully before you will be able to use most GLFW functions.If GLFW has been successfully initialized, this function should be called before the application exits. If initialization fails, there is no need to call this function, as it is called by
init()
before it returns failure.This function has no effect if GLFW is not initialized.
- See Also:
- Errors:
- Possible errors include
PLATFORM_ERROR
. - Remarks:
- This function may be called before
init()
. - Thread safety:
- This function must only be called from the main thread.
- Warning:
- The contexts of any remaining windows must not be current on any other thread when this function is called.
- Reentrancy:
- This function must not be called from a callback.
-
initHint
public static void initHint(int hint, int value) Sets the specified init hint to the desired value.This function sets hints for the next initialization of GLFW. The values you set hints to are never reset by GLFW, but they only take effect during initialization. Once GLFW has been initialized, any values you set will be ignored until the library is terminated and initialized again.
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:
hint
- The init hint to set.value
- The new value of the init hint.- See Also:
- Errors:
- Possible errors include
INVALID_ENUM
andINVALID_VALUE
. - Remarks:
- This function may be called before
init()
. - Thread safety:
- This function must only be called from the main thread.
-
ngetVersion
public static void ngetVersion(MemorySegmentPREVIEW major, MemorySegmentPREVIEW minor, MemorySegmentPREVIEW rev) Retrieves the version of the GLFW library.This function retrieves the major, minor and revision numbers of the GLFW library. It is intended for when you are using GLFW as a shared library and want to ensure that you are using the minimum required version.
- Parameters:
major
- Where to store the major version number, orNULL
PREVIEW.minor
- Where to store the minor version number, orNULL
PREVIEW.rev
- Where to store the revision number, orNULL
PREVIEW.- See Also:
- Errors:
- None.
- Remarks:
- This function may be called before
init()
. - Thread safety:
- This function may be called from any thread.
-
getVersion
public static void getVersion(int @Nullable [] major, int @Nullable [] minor, int @Nullable [] rev) Retrieves the version of the GLFW library.- Parameters:
major
- Where to store the major version number, ornull
.minor
- Where to store the minor version number, ornull
.rev
- Where to store the revision number, ornull
.- See Also:
-
getVersion
Retrieves the version of the GLFW library.- Returns:
- the major, minor and revision version number
- See Also:
-
ngetVersionString
Returns a string describing the compile-time configuration.This function returns the compile-time generated version string of the GLFW library binary. It describes the version, platform, compiler and any platform-specific compile-time options. It should not be confused with the OpenGL or OpenGL ES version string, queried with
GL.getString
.Do not use the version string to parse the GLFW library version. The
getVersion
PREVIEW function provides the version of the running library binary in numerical format.- Returns:
- The ASCII encoded GLFW version string.
- See Also:
- Errors:
- None.
- Remarks:
- This function may be called before
init()
. - Thread safety:
- This function may be called from any thread.
-
getVersionString
Returns a string describing the compile-time configuration.- Returns:
- The ASCII encoded GLFW version string.
- See Also:
-
ngetError
Returns and clears the last error for the calling thread.This function returns and clears the error code of the last error that occurred on the calling thread, and optionally a UTF-8 encoded human-readable description of it. If no error has occurred since the last call, it returns
NO_ERROR
(zero) and the description pointer is set toNULL
PREVIEW.- Parameters:
description
- Where to store the error description pointer, orNULL
PREVIEW.- Returns:
- The last error code for the calling thread, or
NO_ERROR
(zero). - See Also:
- Errors:
- None.
- Remarks:
- This function may be called before
init()
. - Thread safety:
- This function may be called from any thread.
- Pointer lifetime:
- The returned string is allocated and freed by GLFW. You should not free it yourself. It is guaranteed to be valid only until the next error occurs or the library is terminated.
-
getError
Returns and clears the last error for the calling thread.- Parameters:
description
- Where to store the error description pointer, ornull
.- Returns:
- The last error code for the calling thread, or
NO_ERROR
(zero). - See Also:
-
getError
Returns and clears the last error for the calling thread.- Returns:
- the error description pointer. and the last error code for the calling thread, or
NO_ERROR
(zero) - See Also:
-
nsetErrorCallback
Sets the error callback.This function sets the error callback, which is called with an error code and a human-readable description each time a GLFW error occurs.
The error code is set before the callback is called. Calling
getError(java.lang.String[])
from the error callback will return the same value as the error code argument.The error callback is called on the thread where the error occurred. If you are using GLFW from multiple threads, your error callback needs to be written accordingly.
Because the description string may have been generated specifically for that error, it is not guaranteed to be valid after the callback has returned. If you wish to use it after the callback returns, you need to make a copy.
Once set, the error callback remains set even after the library has been terminated.
- Parameters:
callback
- The new callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set. - See Also:
- Errors:
- None.
- Remarks:
- This function may be called before
init()
. - Thread safety:
- This function must only be called from the main thread.
-
setErrorCallback
Sets the error callback. -
ngetMonitors
Returns the currently connected monitors.This function returns an array of handles for all currently connected monitors. The primary monitor is always first in the returned array. If no monitors were found, this function returns
NULL
PREVIEW.- Parameters:
count
- Where to store the number of monitors in the returned array. This is set to zero if an error occurred.- Returns:
- An array of monitor handles, or
NULL
PREVIEW if no monitors were found or if an error occurred. - See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The returned array is allocated and freed by GLFW. You should not free it yourself. It is guaranteed to be valid only until the monitor configuration changes or the library is terminated.
-
getMonitors
Returns the currently connected monitors.- Returns:
- An array of monitor handles, or
null
if no monitors were found or if an error occurred. - See Also:
-
getPrimaryMonitor
Returns the primary monitor.This function returns the primary monitor. This is usually the monitor where elements like the task bar or global menu bar are located.
- Returns:
- The primary monitor, or
NULL
PREVIEW if no monitors were found or if an error occurred. - See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
. - Remarks:
- The primary monitor is always first in the array returned by
getMonitors
PREVIEW. - Thread safety:
- This function must only be called from the main thread.
-
ngetMonitorPos
public static void ngetMonitorPos(MemorySegmentPREVIEW monitor, MemorySegmentPREVIEW xpos, MemorySegmentPREVIEW ypos) Returns the position of the monitor's viewport on the virtual screen.This function returns the position, in screen coordinates, of the upper-left corner of the specified monitor.
Any or all of the position arguments may be
NULL
PREVIEW. If an error occurs, all non-NULL
PREVIEW position arguments will be set to zero.- Parameters:
monitor
- The monitor to query.xpos
- Where to store the monitor x-coordinate, orNULL
PREVIEW.ypos
- Where to store the monitor y-coordinate, orNULL
PREVIEW.- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
getMonitorPos
public static void getMonitorPos(MemorySegmentPREVIEW monitor, int @Nullable [] xpos, int @Nullable [] ypos) Returns the position of the monitor's viewport on the virtual screen.- Parameters:
monitor
- The monitor to query.xpos
- Where to store the monitor x-coordinate, ornull
.ypos
- Where to store the monitor y-coordinate, ornull
.- See Also:
-
getMonitorPos
Returns the position of the monitor's viewport on the virtual screen.- Parameters:
monitor
- The monitor to query.- Returns:
- the monitor xy-coordinate
- See Also:
-
ngetMonitorWorkarea
public static void ngetMonitorWorkarea(MemorySegmentPREVIEW monitor, MemorySegmentPREVIEW xpos, MemorySegmentPREVIEW ypos, MemorySegmentPREVIEW width, MemorySegmentPREVIEW height) Retrieves the work area of the monitor.This function returns the position, in screen coordinates, of the upper-left corner of the work area of the specified monitor along with the work area size in screen coordinates. The work area is defined as the area of the monitor not occluded by the operating system task bar where present. If no task bar exists then the work area is the monitor resolution in screen coordinates.
Any or all of the position and size arguments may be
NULL
PREVIEW. If an error occurs, all non-NULL
PREVIEW position and size arguments will be set to zero.- Parameters:
monitor
- The monitor to query.xpos
- Where to store the monitor x-coordinate, orNULL
PREVIEW.ypos
- Where to store the monitor y-coordinate, orNULL
PREVIEW.width
- Where to store the monitor width, orNULL
PREVIEW.height
- Where to store the monitor height, orNULL
PREVIEW.- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
getMonitorWorkarea
public static void getMonitorWorkarea(MemorySegmentPREVIEW monitor, int @Nullable [] xpos, int @Nullable [] ypos, int @Nullable [] width, int @Nullable [] height) Retrieves the work area of the monitor.- Parameters:
monitor
- The monitor to query.xpos
- Where to store the monitor x-coordinate, ornull
.ypos
- Where to store the monitor y-coordinate, ornull
.width
- Where to store the monitor width, ornull
.height
- Where to store the monitor height, ornull
.- See Also:
-
getMonitorWorkarea
Retrieves the work area of the monitor.- Parameters:
monitor
- The monitor to query.- Returns:
- the monitor xy-coordinate, the monitor width and the monitor height
- See Also:
-
ngetMonitorPhysicalSize
public static void ngetMonitorPhysicalSize(MemorySegmentPREVIEW monitor, MemorySegmentPREVIEW widthMM, MemorySegmentPREVIEW heightMM) Returns the physical size of the monitor.This function returns the size, in millimetres, of the display area of the specified monitor.
Some systems do not provide accurate monitor size information, either because the monitor EDID data is incorrect or because the driver does not report it accurately.
Any or all of the size arguments may be
NULL
PREVIEW. If an error occurs, all non-NULL
PREVIEW size arguments will be set to zero.- Parameters:
monitor
- The monitor to query.widthMM
- Where to store the width, in millimetres, of the monitor's display area, orNULL
PREVIEW.heightMM
- Where to store the height, in millimetres, of the monitor's display area, orNULL
PREVIEW.- Errors:
- Possible errors include
NOT_INITIALIZED
. - Remarks:
- Windows: On Windows 8 and earlier the physical size is calculated from the current resolution and system DPI instead of querying the monitor EDID data.
- Thread safety:
- This function must only be called from the main thread.
-
getMonitorPhysicalSize
public static void getMonitorPhysicalSize(MemorySegmentPREVIEW monitor, int @Nullable [] widthMM, int @Nullable [] heightMM) Returns the physical size of the monitor.- Parameters:
monitor
- The monitor to query.widthMM
- Where to store the width, in millimetres, of the monitor's display area, ornull
.heightMM
- Where to store the height, in millimetres, of the monitor's display area, ornull
.- See Also:
-
getMonitorPhysicalSize
Returns the physical size of the monitor.- Parameters:
monitor
- The monitor to query.- Returns:
- the width and height, in millimetres, of the monitor's display area.
- See Also:
-
ngetMonitorContentScale
public static void ngetMonitorContentScale(MemorySegmentPREVIEW monitor, MemorySegmentPREVIEW xscale, MemorySegmentPREVIEW yscale) Retrieves the content scale for the specified monitor.This function retrieves the content scale for the specified monitor. 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.
The content scale may depend on both the monitor resolution and pixel density and on user settings. It may be very different from the raw DPI calculated from the physical size and current resolution.
- Parameters:
monitor
- The monitor to query.xscale
- Where to store the x-axis content scale, orNULL
PREVIEW.yscale
- Where to store the y-axis content scale, orNULL
PREVIEW.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
getMonitorContentScale
public static void getMonitorContentScale(MemorySegmentPREVIEW monitor, float @Nullable [] xscale, float @Nullable [] yscale) Retrieves the content scale for the specified monitor.- Parameters:
monitor
- The monitor to query.xscale
- Where to store the x-axis content scale, ornull
.yscale
- Where to store the y-axis content scale, ornull
.- See Also:
-
getMonitorContentScale
Retrieves the content scale for the specified monitor.- Parameters:
monitor
- The monitor to query.- Returns:
- the xy-axis content scale
- See Also:
-
ngetMonitorName
Returns the name of the specified monitor.This function returns a human-readable name, encoded as UTF-8, of the specified monitor. The name typically reflects the make and model of the monitor and is not guaranteed to be unique among the connected monitors.
- Parameters:
monitor
- The monitor to query.- Returns:
- The UTF-8 encoded name of the monitor, or
NULL
PREVIEW if an error occurred. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The returned string is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified monitor is disconnected or the library is terminated.
-
getMonitorName
Returns the name of the specified monitor.- Parameters:
monitor
- The monitor to query.- Returns:
- The UTF-8 encoded name of the monitor, or
null
if an error occurred. - See Also:
-
setMonitorUserPointer
public static void setMonitorUserPointer(MemorySegmentPREVIEW monitor, MemorySegmentPREVIEW pointer) Sets the user pointer of the specified monitor.This function sets the user-defined pointer of the specified monitor. The current value is retained until the monitor is disconnected. The initial value is
NULL
PREVIEW.This function may be called from the monitor callback, even for a monitor that is being disconnected.
- Parameters:
monitor
- The monitor whose pointer to set.pointer
- The new value.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function may be called from any thread. Access is not synchronized.
-
getMonitorUserPointer
Returns the user pointer of the specified monitor.This function returns the current value of the user-defined pointer of the specified monitor. The initial value is
NULL
PREVIEW.This function may be called from the monitor callback, even for a monitor that is being disconnected.
- Parameters:
monitor
- The monitor whose pointer to return.- Returns:
- the user pointer of the specified monitor
- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function may be called from any thread. Access is not synchronized.
-
nsetMonitorCallback
Sets the monitor configuration callback.This function sets the monitor configuration callback, or removes the currently set callback. This is called when a monitor is connected to or disconnected from the system.
- Parameters:
callback
- The new callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(GLFWmonitor* monitor, int event)
function pointer type
.
-
setMonitorCallback
Sets the monitor configuration callback.- Parameters:
callback
- The new callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
ngetVideoModes
public static MemorySegmentPREVIEW ngetVideoModes(MemorySegmentPREVIEW monitor, MemorySegmentPREVIEW count) Returns the available video modes for the specified monitor.This function returns an array of all video modes supported by the specified monitor. The returned array is sorted in ascending order, first by color bit depth (the sum of all channel depths), then by resolution area (the product of width and height), then resolution width and finally by refresh rate.
- Parameters:
monitor
- The monitor to query.count
- Where to store the number of video modes in the returned array. This is set to zero if an error occurred.- Returns:
- An array of video modes, or
NULL
PREVIEW if an error occurred. - See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The returned array is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified monitor is disconnected, this function is called again for that monitor or the library is terminated.
-
getVideoModes
@Nullable public static GLFWVidMode.Buffer getVideoModes(SegmentAllocatorPREVIEW allocator, MemorySegmentPREVIEW monitor) Returns the available video modes for the specified monitor.- Parameters:
allocator
- The allocator that allocates the result.monitor
- The monitor to query.- Returns:
- An array of video modes, or
null
if an error occurred. - See Also:
-
ngetVideoMode
Returns the current mode of the specified monitor.This function returns the current video mode of the specified monitor. If you have created a full screen window for that monitor, the return value will depend on whether that window is iconified.
- Parameters:
monitor
- The monitor to query.- Returns:
- The current mode of the monitor, or
NULL
PREVIEW if an error occurred. - See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The returned array is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified monitor is disconnected or the library is terminated.
-
getVideoMode
Returns the current mode of the specified monitor.- Parameters:
monitor
- The monitor to query.- Returns:
- The current mode of the monitor, or
null
if an error occurred. - See Also:
-
setGamma
Generates a gamma ramp and sets it for the specified monitor.This function generates an appropriately sized gamma ramp from the specified exponent and then calls
setGammaRamp
PREVIEW with it. The value must be a finite number greater than zero.The software controlled gamma ramp is applied in addition to the hardware gamma correction, which today is usually an approximation of sRGB gamma. This means that setting a perfectly linear ramp, or gamma 1.0, will produce the default (usually sRGB-like) behavior.
For gamma correct rendering with OpenGL or OpenGL ES, see the
SRGB_CAPABLE
hint.- Parameters:
monitor
- The monitor whose gamma ramp to set.gamma
- The desired exponent.- Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_VALUE
andPLATFORM_ERROR
. - Remarks:
- Wayland: Gamma handling is a privileged protocol, this function
will thus never be implemented and emits
PLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
ngetGammaRamp
Returns the current gamma ramp for the specified monitor.This function returns the current gamma ramp of the specified monitor.
- Parameters:
monitor
- The monitor to query.- Returns:
- The current gamma ramp, or
NULL
PREVIEW if an error occurred. - Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Remarks:
- Wayland: Gamma handling is a privileged protocol, this function
will thus never be implemented and emits
PLATFORM_ERROR
while returningNULL
PREVIEW. - Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The returned structure and its arrays are allocated and freed by GLFW. You should not free them yourself. They are valid until the specified monitor is disconnected, this function is called again for that monitor or the library is terminated.
-
getGammaRamp
Returns the current gamma ramp for the specified monitor.- Parameters:
monitor
- The monitor to query.- Returns:
- The current gamma ramp, or
null
if an error occurred. - See Also:
-
nsetGammaRamp
Sets the current gamma ramp for the specified monitor.This function sets the current gamma ramp for the specified monitor. The original gamma ramp for that monitor is saved by GLFW the first time this function is called and is restored by
terminate()
.The software controlled gamma ramp is applied in addition to the hardware gamma correction, which today is usually an approximation of sRGB gamma. This means that setting a perfectly linear ramp, or gamma 1.0, will produce the default (usually sRGB-like) behavior.
For gamma correct rendering with OpenGL or OpenGL ES, see the
SRGB_CAPABLE
hint.- Parameters:
monitor
- The monitor whose gamma ramp to set.ramp
- The gamma ramp to use.- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Remarks:
- The size of the specified gamma ramp should match the size of the
current ramp for that monitor.
Windows: The gamma ramp size must be 256.
Wayland: Gamma handling is a privileged protocol, this function will thus never be implemented and emits
PLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The specified gamma ramp is copied before this function returns.
-
setGammaRamp
Sets the current gamma ramp for the specified monitor.- Parameters:
monitor
- The monitor whose gamma ramp to set.ramp
- The gamma ramp to use.- See Also:
-
defaultWindowHints
public static void defaultWindowHints()Resets all window hints to their default values.This function resets all window hints to their default values.
- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
-
windowHint
public static void windowHint(int hint, int value) Sets the specified window hint to the desired value.This function sets hints for the next call to
createWindow
PREVIEW. The hints, once set, retain their values until changed by a call to this function ordefaultWindowHints()
, or until the library is terminated.Only integer value hints can be set with this function. String value hints are set with
windowHintString
PREVIEW.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
createWindow
PREVIEW.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:
hint
- The window hint to set.value
- The new value of the window hint.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andINVALID_ENUM
. - Thread safety:
- This function must only be called from the main thread.
-
windowHint
public static void windowHint(int hint, boolean value) Sets the specified window hint to the desired value.- Parameters:
hint
- The window hint to set.value
- The new value of the window hint.- See Also:
-
nwindowHintString
Sets the specified window hint to the desired value.This function sets hints for the next call to
createWindow
PREVIEW. The hints, once set, retain their values until changed by a call to this function ordefaultWindowHints()
, or until the library is terminated.Only string type hints can be set with this function. Integer value hints are set with
windowHint
.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
ncreateWindow(int, int, java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment)
PREVIEW.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:
hint
- The window hint to set.value
- The new value of the window hint.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andINVALID_ENUM
. - Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The specified string is copied before this function returns.
-
windowHintString
Sets the specified window hint to the desired value.- Parameters:
hint
- The window hint to set.value
- The new value of the window hint.- See Also:
-
ncreateWindow
public static MemorySegmentPREVIEW ncreateWindow(int width, int height, MemorySegmentPREVIEW title, MemorySegmentPREVIEW monitor, MemorySegmentPREVIEW 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 object 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
getWindowAttrib(java.lang.foreign.MemorySegment, int)
PREVIEW,getWindowSize
PREVIEW andgetFramebufferSize
PREVIEW.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 Retrieving 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 "Windowed full screen" windows.
Once you have created the window, you can switch it between windowed and full screen mode with
setWindowMonitor(java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment, int, int, int, int, int)
PREVIEW. 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
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:
width
- The desired width, in screen coordinates, of the window. This must be greater than zero.height
- The desired height, in screen coordinates, of the window. This must be greater than zero.title
- The initial, UTF-8 encoded window title.monitor
- The monitor to use for full screen mode, orNULL
PREVIEW for windowed mode.share
- The window whose context to share resources with, orNULL
PREVIEW to not share resources.- Returns:
- The handle of the created window, or
NULL
PREVIEW if an error occurred. - See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_ENUM
,INVALID_VALUE
,API_UNAVAILABLE
,VERSION_UNAVAILABLE
,FORMAT_UNAVAILABLE
andPLATFORM_ERROR
. - Remarks:
- Windows: Window creation will fail if the Microsoft GDI software
OpenGL implementation is the only one available.
Windows: 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, theIDI_APPLICATION
icon will be used instead. To set a different icon, seesetWindowIcon
PREVIEW.Windows: The context to share resources with must not be current on any other thread.
macOS: 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
OPENGL_FORWARD_COMPAT
andOPENGL_PROFILE
hints accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.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.
macOS: 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 theCOCOA_MENUBAR
init hint.macOS: On OS X 10.10 and later the window frame will not be rendered at full resolution on Retina displays unless the
COCOA_RETINA_FRAMEBUFFER
hint isTRUE
and theNSHighResolutionCapable
key is enabled in the application bundle'sInfo.plist
. For more information, see High Resolution Guidelines for OS X in the Mac Developer Library. The GLFW test and example programs use a customInfo.plist
template for this, which can be found asCMake/MacOSXBundleInfo.plist.in
in the source tree.macOS: When activating frame autosaving with
COCOA_FRAME_NAME
, the specified window size and position may be overridden by previously saved values.X11: Some window managers will not respect the placement of initially hidden windows.
X11: 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.
X11: 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 theRESOURCE_NAME
environment variable, if present and not empty, or fall back to the window title. Set theX11_CLASS_NAME
andX11_INSTANCE_NAME
window hints to override this.Wayland: 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.
Wayland: A full screen window will not attempt to change the mode, no matter what the requested size or refresh rate.
Wayland: Screensaver inhibition requires the idle-inhibit protocol to be implemented in the user's compositor.
- Thread safety:
- This function must only be called from the main thread.
-
createWindow
public static MemorySegmentPREVIEW createWindow(int width, int height, String title, MemorySegmentPREVIEW monitor, MemorySegmentPREVIEW share) Creates a window and its associated context.- Parameters:
width
- The desired width, in screen coordinates, of the window. This must be greater than zero.height
- The desired height, in screen coordinates, of the window. This must be greater than zero.title
- The initial, UTF-8 encoded window title.monitor
- The monitor to use for full screen mode, orNULL
PREVIEW for windowed mode.share
- The window whose context to share resources with, orNULL
PREVIEW to not share resources.- Returns:
- The handle of the created window, or
NULL
PREVIEW if an error occurred. - See Also:
-
destroyWindow
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:
window
- The window to destroy.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
- Reentrancy:
- This function must not be called from a callback.
- Note:
- The context of the specified window must not be current on any other thread when this function is called.
-
windowShouldClose
Checks the close flag of the specified window.This function returns the value of the close flag of the specified window.
- Parameters:
window
- The window to query.- Returns:
- The value of the close flag.
- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function may be called from any thread. Access is not synchronized.
-
setWindowShouldClose
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:
window
- The window whose flag to change.value
- The new value.- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function may be called from any thread. Access is not synchronized.
-
nsetWindowTitle
Sets the title of the specified window.This function sets the window title, encoded as UTF-8, of the specified window.
- Parameters:
window
- The window whose title to change.title
- The UTF-8 encoded window title.- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Remarks:
- macOS: The window title will not be updated until the next time you process events.
- Thread safety:
- This function must only be called from the main thread.
-
setWindowTitle
Sets the title of the specified window.- Parameters:
window
- The window whose title to change.title
- The UTF-8 encoded window title.- See Also:
-
nsetWindowIcon
public static void nsetWindowIcon(MemorySegmentPREVIEW window, int count, MemorySegmentPREVIEW 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:
window
- The window whose icon to set.count
- The number of images in the specified array, or zero to revert to the default window icon.images
- The images to create the icon from. This is ignored if count is zero.- Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_VALUE
andPLATFORM_ERROR
. - Remarks:
- macOS: 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.
Wayland: 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
PLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The specified image data is copied before this function returns.
-
setWindowIcon
Sets the icon for the specified window.- Parameters:
window
- The window whose icon to set.count
- The number of images in the specified array, or zero to revert to the default window icon.images
- The images to create the icon from. This is ignored if count is zero.- See Also:
-
setWindowIcon
Sets the icon for the specified window.- Parameters:
window
- The window whose icon to set.images
- The images to create the icon from, ornull
to revert to the default window icon.- See Also:
-
ngetWindowPos
public static void ngetWindowPos(MemorySegmentPREVIEW window, MemorySegmentPREVIEW xpos, MemorySegmentPREVIEW 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
PREVIEW. If an error occurs, all non-NULL
PREVIEW position arguments will be set to zero.- Parameters:
window
- The window to query.xpos
- Where to store the x-coordinate of the upper-left corner of the content area, orNULL
PREVIEW.ypos
- Where to store the y-coordinate of the upper-left corner of the content area, orNULL
PREVIEW.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Remarks:
- Wayland: There is no way for an application to retrieve the global
position of its windows, this function will always emit
PLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
getWindowPos
public static void getWindowPos(MemorySegmentPREVIEW window, int @Nullable [] xpos, int @Nullable [] ypos) Retrieves the position of the content area of the specified window.- Parameters:
window
- The window to query.xpos
- Where to store the x-coordinate of the upper-left corner of the content area, ornull
.ypos
- Where to store the y-coordinate of the upper-left corner of the content area, ornull
.
-
getWindowPos
Retrieves the position of the content area of the specified window.- Parameters:
window
- The window to query.- Returns:
- the xy-coordinate of the upper-left corner of the content area.
-
setWindowPos
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:
window
- The window to query.xpos
- The x-coordinate of the upper-left corner of the content area.ypos
- The y-coordinate of the upper-left corner of the content area.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Remarks:
- Wayland: There is no way for an application to set the global
position of its windows, this function will always emit
PLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
ngetWindowSize
public static void ngetWindowSize(MemorySegmentPREVIEW window, MemorySegmentPREVIEW width, MemorySegmentPREVIEW 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
getFramebufferSize
PREVIEW.Any or all of the size arguments may be
NULL
PREVIEW. If an error occurs, all non-NULL
PREVIEW size arguments will be set to zero.- Parameters:
window
- The window whose size to retrieve.width
- Where to store the width, in screen coordinates, of the content area, orNULL
PREVIEW.height
- Where to store the height, in screen coordinates, of the content area, orNULL
PREVIEW.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
getWindowSize
public static void getWindowSize(MemorySegmentPREVIEW window, int @Nullable [] width, int @Nullable [] height) Retrieves the size of the content area of the specified window.- Parameters:
window
- The window whose size to retrieve.width
- Where to store the width, in screen coordinates, of the content area, ornull
.height
- Where to store the height, in screen coordinates, of the content area, ornull
.- See Also:
-
getWindowSize
Retrieves the size of the content area of the specified window.- Parameters:
window
- The window whose size to retrieve.- Returns:
- the width and height, in screen coordinates, of the content area.
- See Also:
-
setWindowSizeLimits
public static void setWindowSizeLimits(MemorySegmentPREVIEW 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:
window
- The window to set limits for.minWidth
- The minimum width, in screen coordinates, of the content area, orDONT_CARE
.minHeight
- The minimum height, in screen coordinates, of the content area, orDONT_CARE
.maxWidth
- The maximum width, in screen coordinates, of the content area, orDONT_CARE
.maxHeight
- The maximum height, in screen coordinates, of the content area, orDONT_CARE
.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_VALUE
andPLATFORM_ERROR
. - Remarks:
- If you set size limits and an aspect ratio that conflict, the
results are undefined.
Wayland: The size limits will not be applied until the window is actually resized, either by the user or by the compositor.
- Thread safety:
- This function must only be called from the main thread.
-
setWindowAspectRatio
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
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:
window
- The window to set limits for.numer
- The numerator of the desired aspect ratio, orDONT_CARE
.denom
- The denominator of the desired aspect ratio, orDONT_CARE
.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_VALUE
andPLATFORM_ERROR
. - Remarks:
- If you set size limits and an aspect ratio that conflict, the
results are undefined.
Wayland: The aspect ratio will not be applied until the window is actually resized, either by the user or by the compositor.
- Thread safety:
- This function must only be called from the main thread.
-
setWindowSize
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
setWindowMonitor
PREVIEW.The window manager may put limits on what sizes are allowed. GLFW cannot and should not override these limits.
- Parameters:
window
- The window to resize.width
- The desired width, in screen coordinates, of the window content area.height
- The desired height, in screen coordinates, of the window content area.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Remarks:
- Wayland: A full screen window will not attempt to change the mode, no matter what the requested size.
- Thread safety:
- This function must only be called from the main thread.
-
ngetFramebufferSize
public static void ngetFramebufferSize(MemorySegmentPREVIEW window, MemorySegmentPREVIEW width, MemorySegmentPREVIEW 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
getWindowSize
PREVIEW.Any or all of the size arguments may be
NULL
PREVIEW. If an error occurs, all non-NULL
PREVIEW size arguments will be set to zero.- Parameters:
window
- The window whose framebuffer to query.width
- Where to store the width, in pixels, of the framebuffer, orNULL
PREVIEW.height
- Where to store the height, in pixels, of the framebuffer, orNULL
PREVIEW.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
getFramebufferSize
public static void getFramebufferSize(MemorySegmentPREVIEW window, int @Nullable [] width, int @Nullable [] height) Retrieves the size of the framebuffer of the specified window.- Parameters:
window
- The window whose framebuffer to query.width
- Where to store the width, in pixels, of the framebuffer, ornull
.height
- Where to store the height, in pixels, of the framebuffer, ornull
.- See Also:
-
getFramebufferSize
Retrieves the size of the framebuffer of the specified window.- Parameters:
window
- The window whose framebuffer to query.- Returns:
- the width and height, in pixels, of the framebuffer.
- See Also:
-
ngetWindowFrameSize
public static void ngetWindowFrameSize(MemorySegmentPREVIEW window, MemorySegmentPREVIEW left, MemorySegmentPREVIEW top, MemorySegmentPREVIEW right, MemorySegmentPREVIEW 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
PREVIEW. If an error occurs, all non-NULL
PREVIEW size arguments will be set to zero.- Parameters:
window
- The window whose frame size to query.left
- Where to store the size, in screen coordinates, of the left edge of the window frame, orNULL
PREVIEW.top
- Where to store the size, in screen coordinates, of the top edge of the window frame, orNULL
PREVIEW.right
- Where to store the size, in screen coordinates, of the right edge of the window frame, orNULL
PREVIEW.bottom
- Where to store the size, in screen coordinates, of the bottom edge of the window frame, orNULL
PREVIEW.- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
getWindowFrameSize
public static void getWindowFrameSize(MemorySegmentPREVIEW window, int @Nullable [] left, int @Nullable [] top, int @Nullable [] right, int @Nullable [] bottom) Retrieves the size of the frame of the window.- Parameters:
window
- The window whose frame size to query.left
- Where to store the size, in screen coordinates, of the left edge of the window frame, ornull
.top
- Where to store the size, in screen coordinates, of the top edge of the window frame, ornull
.right
- Where to store the size, in screen coordinates, of the right edge of the window frame, ornull
.bottom
- Where to store the size, in screen coordinates, of the bottom edge of the window frame, ornull
.- See Also:
-
getWindowFrameSize
Retrieves the size of the frame of the window.- Parameters:
window
- The window whose frame size to query.- Returns:
- the size, in screen coordinates, of the left, top, right and bottom edge of the window frame.
- See Also:
-
ngetWindowContentScale
public static void ngetWindowContentScale(MemorySegmentPREVIEW window, MemorySegmentPREVIEW xscale, MemorySegmentPREVIEW 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:
window
- The window to query.xscale
- Where to store the x-axis content scale, orNULL
PREVIEW.yscale
- Where to store the y-axis content scale, orNULL
PREVIEW.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
getWindowContentScale
public static void getWindowContentScale(MemorySegmentPREVIEW window, float @Nullable [] xscale, float @Nullable [] yscale) Retrieves the content scale for the specified window.- Parameters:
window
- The window to query.xscale
- Where to store the x-axis content scale, ornull
.yscale
- Where to store the y-axis content scale, ornull
.- See Also:
-
getWindowContentScale
Retrieves the content scale for the specified window.- Parameters:
window
- The window to query.- Returns:
- the xy-axis content scale.
- See Also:
-
getWindowOpacity
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:
window
- The window to query.- Returns:
- The opacity value of the specified window.
- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
setWindowOpacity
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:
window
- The window to set the opacity for.opacity
- The desired opacity of the specified window.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
iconifyWindow
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:
window
- The window to iconify.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
restoreWindow
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:
window
- The window to restore.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
maximizeWindow
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:
window
- The window to maximize.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function may only be called from the main thread.
-
showWindow
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
FOCUS_ON_SHOW
window hint to change this behavior for all newly created windows, or change the behavior for an existing window withsetWindowAttrib(java.lang.foreign.MemorySegment, int, boolean)
PREVIEW.- Parameters:
window
- The window to make visible.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Remarks:
- Wayland: 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.
- Thread safety:
- This function must only be called from the main thread.
-
hideWindow
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:
window
- The window to hide.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
focusWindow
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
FOCUSED
to disable this behavior.Also by default, windowed mode windows are focused when shown with
showWindow(java.lang.foreign.MemorySegment)
PREVIEW. Set theFOCUS_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:
window
- The window to give input focus.- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Remarks:
- Wayland: It is not possible for an application to bring its windows
to front, this function will always emit
PLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
requestWindowAttention
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:
window
- The window to request attention to.- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Remarks:
- macOS: Attention is requested to the application as a whole, not the specific window.
- Thread safety:
- This function must only be called from the main thread.
-
getWindowMonitor
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:
window
- The window to query.- Returns:
- The monitor, or
NULL
PREVIEW if the window is in windowed mode or an error occurred. - See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
-
setWindowMonitor
public static void setWindowMonitor(MemorySegmentPREVIEW window, MemorySegmentPREVIEW 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
PREVIEW, 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
PREVIEW, 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
setWindowSize(java.lang.foreign.MemorySegment, int, int)
PREVIEW.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:
window
- The window whose monitor, size or video mode to set.monitor
- The desired monitor, orNULL
PREVIEW to set windowed mode.xpos
- The desired x-coordinate of the upper-left corner of the content area.ypos
- The desired y-coordinate of the upper-left corner of the content area.width
- The desired with, in screen coordinates, of the content area or video mode.height
- The desired height, in screen coordinates, of the content area or video mode.refreshRate
- The desired refresh rate, in Hz, of the video mode, orDONT_CARE
.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_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.
Wayland: The desired window position is ignored, as there is no way for an application to set this property.
Wayland: Setting the window to full screen will not attempt to change the mode, no matter what the requested size or refresh rate.
- Thread safety:
- This function must only be called from the main thread.
-
getWindowAttrib
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:
window
- The window to query.attrib
- The window attribute whose value to return.- Returns:
- The value of the attribute, or zero if an error occurred.
- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_ENUM
andPLATFORM_ERROR
. - Remarks:
- Framebuffer related hints are not window attributes. See
Framebuffer related attributes
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.
Wayland: The Wayland protocol provides no way to check whether a window is iconfied, so
ICONIFIED
always returnsFALSE
. - Thread safety:
- This function must only be called from the main thread.
-
setWindowAttrib
Sets an attribute of the specified window.This function sets the value of an attribute of the specified window.
The supported attributes are
DECORATED
,RESIZABLE
,FLOATING
,AUTO_ICONIFY
andFOCUS_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:
window
- The window to set the attribute for.attrib
- A supported window attribute.value
-true
offalse
.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_ENUM
,INVALID_VALUE
andPLATFORM_ERROR
. - Remarks:
- Calling
getWindowAttrib(java.lang.foreign.MemorySegment, int)
PREVIEW will always return the latest value, even if that value is ignored by the current mode of the window. - Thread safety:
- This function must only be called from the main thread.
-
setWindowUserPointer
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
PREVIEW.- Parameters:
window
- The window whose pointer to set.pointer
- The new value.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function may be called from any thread. Access is not synchronized.
-
getWindowUserPointer
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
PREVIEW.- Parameters:
window
- The window whose pointer to return.- Returns:
- the user pointer of the specified window
- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function may be called from any thread. Access is not synchronized.
-
nsetWindowPosCallback
public static MemorySegmentPREVIEW nsetWindowPosCallback(MemorySegmentPREVIEW window, MemorySegmentPREVIEW 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:
window
- The window whose callback to set.callback
- The new callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Remarks:
- Wayland: This callback will never be called, as there is no way for an application to know its global position.
- Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(GLFWwindow* window, int xpos, int ypos)
function pointer type
.
-
setWindowPosCallback
public static MemorySegmentPREVIEW setWindowPosCallback(MemorySegmentPREVIEW window, @Nullable @Nullable IGLFWWindowPosFun callback) Sets the position callback for the specified window.- Parameters:
window
- The window whose callback to set.callback
- The new callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
nsetWindowSizeCallback
public static MemorySegmentPREVIEW nsetWindowSizeCallback(MemorySegmentPREVIEW window, MemorySegmentPREVIEW 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:
window
- The window whose callback to set.callback
- The new callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(GLFWwindow* window, int width, int height)
function pointer type
.
-
setWindowSizeCallback
public static MemorySegmentPREVIEW setWindowSizeCallback(MemorySegmentPREVIEW window, @Nullable @Nullable IGLFWWindowSizeFun callback) Sets the size callback for the specified window.- Parameters:
window
- The window whose callback to set.callback
- The new callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
nsetWindowCloseCallback
public static MemorySegmentPREVIEW nsetWindowCloseCallback(MemorySegmentPREVIEW window, MemorySegmentPREVIEW 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
setWindowShouldClose(java.lang.foreign.MemorySegment, boolean)
PREVIEW.The close callback is not triggered by
destroyWindow(java.lang.foreign.MemorySegment)
PREVIEW.- Parameters:
window
- The window whose callback to set.callback
- The new callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Remarks:
- macOS: Selecting Quit from the application menu will trigger the close callback for all windows.
- Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(GLFWwindow* window)
function pointer type
.
-
setWindowCloseCallback
public static MemorySegmentPREVIEW setWindowCloseCallback(MemorySegmentPREVIEW window, @Nullable @Nullable IGLFWWindowCloseFun callback) Sets the close callback for the specified window.- Parameters:
window
- The window whose callback to set.callback
- The new callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
nsetWindowRefreshCallback
public static MemorySegmentPREVIEW nsetWindowRefreshCallback(MemorySegmentPREVIEW window, MemorySegmentPREVIEW 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:
window
- The window whose callback to set.callback
- The new callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(GLFWwindow* window);
function pointer type
.
-
setWindowRefreshCallback
public static MemorySegmentPREVIEW setWindowRefreshCallback(MemorySegmentPREVIEW window, @Nullable @Nullable IGLFWWindowRefreshFun callback) Sets the refresh callback for the specified window.- Parameters:
window
- The window whose callback to set.callback
- The new callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
nsetWindowFocusCallback
public static MemorySegmentPREVIEW nsetWindowFocusCallback(MemorySegmentPREVIEW window, MemorySegmentPREVIEW 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
setKeyCallback
PREVIEW andsetMouseButtonCallback
PREVIEW.- Parameters:
window
- The window whose callback to set.callback
- The new callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(GLFWwindow* window, int focused)
function pointer type
.
-
setWindowFocusCallback
public static MemorySegmentPREVIEW setWindowFocusCallback(MemorySegmentPREVIEW window, @Nullable @Nullable IGLFWWindowFocusFun callback) Sets the focus callback for the specified window.- Parameters:
window
- The window whose callback to set.callback
- The new callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
nsetWindowIconifyCallback
public static MemorySegmentPREVIEW nsetWindowIconifyCallback(MemorySegmentPREVIEW window, MemorySegmentPREVIEW 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:
window
- The window whose callback to set.callback
- The new callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Remarks:
- Wayland: The XDG-shell protocol has no event for iconification, so this callback will never be called.
- Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(GLFWwindow* window, int iconified)
function pointer type
.
-
setWindowIconifyCallback
public static MemorySegmentPREVIEW setWindowIconifyCallback(MemorySegmentPREVIEW window, @Nullable @Nullable IGLFWWindowIconifyFun callback) Sets the iconify callback for the specified window.- Parameters:
window
- The window whose callback to set.callback
- The new callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
nsetWindowMaximizeCallback
public static MemorySegmentPREVIEW nsetWindowMaximizeCallback(MemorySegmentPREVIEW window, MemorySegmentPREVIEW 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:
window
- The window whose callback to set.callback
- The new callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(GLFWwindow* window, int maximized)
function pointer type
.
-
setWindowMaximizeCallback
public static MemorySegmentPREVIEW setWindowMaximizeCallback(MemorySegmentPREVIEW window, @Nullable @Nullable IGLFWWindowMaximizeFun callback) Sets the maximize callback for the specified window.- Parameters:
window
- The window whose callback to set.callback
- The new callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
nsetFramebufferSizeCallback
public static MemorySegmentPREVIEW nsetFramebufferSizeCallback(MemorySegmentPREVIEW window, MemorySegmentPREVIEW 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:
window
- The window whose callback to set.callback
- The new callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(GLFWwindow* window, int width, int height)
function pointer type
.
-
setFramebufferSizeCallback
public static MemorySegmentPREVIEW setFramebufferSizeCallback(MemorySegmentPREVIEW window, @Nullable @Nullable IGLFWFramebufferSizeFun callback) Sets the framebuffer resize callback for the specified window.- Parameters:
window
- The window whose callback to set.callback
- The new callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
nsetWindowContentScaleCallback
public static MemorySegmentPREVIEW nsetWindowContentScaleCallback(MemorySegmentPREVIEW window, MemorySegmentPREVIEW 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:
window
- The window whose callback to set.callback
- The new callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(GLFWwindow* window, float xscale, float yscale)
function pointer type
.
-
setWindowContentScaleCallback
public static MemorySegmentPREVIEW setWindowContentScaleCallback(MemorySegmentPREVIEW window, @Nullable @Nullable IGLFWWindowContentScaleFun callback) Sets the window content scale callback for the specified window.- Parameters:
window
- The window whose callback to set.callback
- The new callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
pollEvents
public static void pollEvents()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.
- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
- Reentrancy:
- This function must not be called from a callback.
-
waitEvents
public static void waitEvents()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
pollEvents()
, 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.
- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
- Reentrancy:
- This function must not be called from a callback.
-
waitEventsTimeout
public static void waitEventsTimeout(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
pollEvents()
, 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:
timeout
- The maximum amount of time, in seconds, to wait.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_VALUE
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
- Reentrancy:
- This function must not be called from a callback.
-
postEmptyEvents
public static void postEmptyEvents()Posts an empty event to the event queue.This function posts an empty event from the current thread to the event queue, causing
waitEvents()
orwaitEventsTimeout(double)
to return.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function may be called from any thread.
-
getInputMode
Returns the value of an input option for the specified window.This function returns the value of an input option for the specified window. The mode must be one of
CURSOR
,STICKY_KEYS
,STICKY_MOUSE_BUTTONS
,LOCK_KEY_MODS
orRAW_MOUSE_MOTION
.- Parameters:
window
- The window to query.mode
- One ofCURSOR
,STICKY_KEYS
,STICKY_MOUSE_BUTTONS
,LOCK_KEY_MODS
orRAW_MOUSE_MOTION
.- Returns:
- the value of an input option for the specified window
- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andINVALID_ENUM
. - Thread safety:
- This function must only be called from the main thread.
-
setInputMode
Sets an input option for the specified window.This function sets an input mode option for the specified window. The mode must be one of
CURSOR
,STICKY_KEYS
,STICKY_MOUSE_BUTTONS
,LOCK_KEY_MODS
orRAW_MOUSE_MOTION
.If the mode is
CURSOR
, the value must be one of the following cursor modes:CURSOR_NORMAL
makes the cursor visible and behaving normally.CURSOR_HIDDEN
makes the cursor invisible when it is over the content area of the window but does not restrict the cursor from leaving.CURSOR_DISABLED
hides and grabs the cursor, providing virtual and unlimited cursor movement. This is useful for implementing for example 3D camera controls.
If the mode is
STICKY_KEYS
, the value must be eitherTRUE
to enable sticky keys, orFALSE
to disable it. If sticky keys are enabled, a key press will ensure thatgetKey(java.lang.foreign.MemorySegment, int)
PREVIEW returnsPRESS
the next time it is called even if the key had been released before the call. This is useful when you are only interested in whether keys have been pressed but not when or in which order.If the mode is
STICKY_MOUSE_BUTTONS
, the value must be eitherTRUE
to enable sticky mouse buttons, orFALSE
to disable it. If sticky mouse buttons are enabled, a mouse button press will ensure thatgetMouseButton(java.lang.foreign.MemorySegment, int)
PREVIEW returnsPRESS
the next time it is called even if the mouse button had been released before the call. This is useful when you are only interested in whether mouse buttons have been pressed but not when or in which order.If the mode is
LOCK_KEY_MODS
, the value must be eitherTRUE
to enable lock key modifier bits, orFALSE
to disable them. If enabled, callbacks that receive modifier bits will also have theMOD_CAPS_LOCK
bit set when the event was generated with Caps Lock on, and theMOD_NUM_LOCK
bit when Num Lock was on.If the mode is
RAW_MOUSE_MOTION
, the value must be eitherTRUE
to enable raw (unscaled and unaccelerated) mouse motion when the cursor is disabled, orFALSE
to disable it. If raw motion is not supported, attempting to set this will emitPLATFORM_ERROR
. CallrawMouseMotionSupported()
to check for support.- Parameters:
window
- The window whose input mode to set.mode
- One ofCURSOR
,STICKY_KEYS
,STICKY_MOUSE_BUTTONS
,LOCK_KEY_MODS
orRAW_MOUSE_MOTION
.value
- The new value of the specified input mode.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_ENUM
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
rawMouseMotionSupported
public static boolean rawMouseMotionSupported()Returns whether raw mouse motion is supported.This function returns whether raw mouse motion is supported on the current system. This status does not change after GLFW has been initialized, so you only need to check this once. If you attempt to enable raw motion on a system that does not support it,
PLATFORM_ERROR
will be emitted.Raw mouse motion is closer to the actual motion of the mouse across a surface. It is not affected by the scaling and acceleration applied to the motion of the desktop cursor. That processing is suitable for a cursor while raw motion is better for controlling for example a 3D camera. Because of this, raw mouse motion is only provided when the cursor is disabled.
- Returns:
TRUE
if raw mouse motion is supported on the current machine, orFALSE
otherwise.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
-
ngetKeyName
Returns the layout-specific name of the specified printable key.This function returns the name of the specified printable key, encoded as UTF-8. This is typically the character that key would produce without any modifier keys, intended for displaying key bindings to the user. For dead keys, it is typically the diacritic it would add to a character.
Do not use this function for text input. You will break text input for many languages even if it happens to work for yours.
If the key is
KEY_UNKNOWN
, the scancode is used to identify the key, otherwise the scancode is ignored. If you specify a non-printable key, orKEY_UNKNOWN
and a scancode that maps to a non-printable key, this function returnsNULL
PREVIEW but does not emit an error.This behavior allows you to always pass in the arguments in the key callback without modification.
The printable keys are:
KEY_APOSTROPHE
KEY_COMMA
KEY_MINUS
KEY_PERIOD
KEY_SLASH
KEY_SEMICOLON
KEY_EQUAL
KEY_LEFT_BRACKET
KEY_RIGHT_BRACKET
KEY_BACKSLASH
KEY_WORLD_1
KEY_WORLD_2
KEY_0
toKEY_9
KEY_A
toKEY_Z
KEY_KP_0
toKEY_KP_9
KEY_KP_DECIMAL
KEY_KP_DIVIDE
KEY_KP_MULTIPLY
KEY_KP_SUBTRACT
KEY_KP_ADD
KEY_KP_EQUAL
Names for printable keys depend on keyboard layout, while names for non-printable keys are the same across layouts but depend on the application language and should be localized along with other user interface text.
- Parameters:
key
- The key to query, orKEY_UNKNOWN
.scancode
- The scancode of the key to query.- Returns:
- The UTF-8 encoded, layout-specific name of the key, or
NULL
PREVIEW. - Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Remarks:
- The contents of the returned string may change when a keyboard layout change event is received.
- Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The returned string is allocated and freed by GLFW. You should not free it yourself. It is valid until the library is terminated.
-
getKeyName
Returns the layout-specific name of the specified printable key.- Parameters:
key
- The key to query, orKEY_UNKNOWN
.scancode
- The scancode of the key to query.- Returns:
- The UTF-8 encoded, layout-specific name of the key, or
null
. - See Also:
-
getKeyScancode
public static int getKeyScancode(int key) Returns the platform-specific scancode of the specified key.This function returns the platform-specific scancode of the specified key.
If the key is
KEY_UNKNOWN
or does not exist on the keyboard this method will return-1
.- Parameters:
key
- Any named key.- Returns:
- The platform-specific scancode for the key, or
-1
if an error occurred. - Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_ENUM
andPLATFORM_ERROR
. - Thread safety:
- This function may be called from any thread.
-
getKey
Returns the last reported state of a keyboard key for the specified window.This function returns the last state reported for the specified key to the specified window. The returned state is one of
PRESS
orRELEASE
. The actionREPEAT
is only reported to the key callback.If the
STICKY_KEYS
input mode is enabled, this function returnsPRESS
the first time you call it for a key that was pressed, even if that key has already been released.The key functions deal with physical keys, with key tokens named after their use on the standard US keyboard layout. If you want to input text, use the Unicode character callback instead.
The modifier key bit masks are not key tokens and cannot be used with this function.
Do not use this function to implement text input.
- Parameters:
window
- The desired window.key
- The desired keyboard key.KEY_UNKNOWN
is not a valid key for this function.- Returns:
- One of
PRESS
orRELEASE
. - Errors:
- Possible errors include
NOT_INITIALIZED
andINVALID_ENUM
. - Thread safety:
- This function must only be called from the main thread.
-
getMouseButton
Returns the last reported state of a mouse button for the specified window.This function returns the last state reported for the specified mouse button to the specified window. The returned state is one of
PRESS
orRELEASE
.If the
STICKY_MOUSE_BUTTONS
input mode is enabled, this function returnsPRESS
the first time you call it for a mouse button that was pressed, even if that mouse button has already been released.- Parameters:
window
- The desired window.button
- The desired mouse button.- Returns:
- One of
PRESS
orRELEASE
. - Errors:
- Possible errors include
NOT_INITIALIZED
andINVALID_ENUM
. - Thread safety:
- This function must only be called from the main thread.
-
ngetCursorPos
public static void ngetCursorPos(MemorySegmentPREVIEW window, MemorySegmentPREVIEW xpos, MemorySegmentPREVIEW ypos) Retrieves the position of the cursor relative to the content area of the window.This function returns the position of the cursor, in screen coordinates, relative to the upper-left corner of the content area of the specified window.
If the cursor is disabled (with
CURSOR_DISABLED
) then the cursor position is unbounded and limited only by the minimum and maximum values of adouble
.The coordinate can be converted to their integer equivalents with the
floor
function. Casting directly to an integer type works for positive coordinates, but fails for negative ones.Any or all of the position arguments may be
NULL
PREVIEW. If an error occurs, all non-NULL
PREVIEW position arguments will be set to zero.- Parameters:
window
- The desired window.xpos
- Where to store the cursor x-coordinate, relative to the left edge of the content area, orNULL
PREVIEW.ypos
- Where to store the cursor y-coordinate, relative to the to top edge of the content area, orNULL
PREVIEW.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
getCursorPos
public static void getCursorPos(MemorySegmentPREVIEW window, double @Nullable [] xpos, double @Nullable [] ypos) Retrieves the position of the cursor relative to the content area of the window.- Parameters:
window
- The desired window.xpos
- Where to store the cursor x-coordinate, relative to the left edge of the content area, ornull
.ypos
- Where to store the cursor y-coordinate, relative to the to top edge of the content area, ornull
.- See Also:
-
getCursorPos
Retrieves the position of the cursor relative to the content area of the window.- Parameters:
window
- The desired window.- Returns:
- the cursor xy-coordinate, relative to the left and top edge of the content area.
- See Also:
-
setCursorPos
Sets the position of the cursor, relative to the content area of the window.This function sets the position, in screen coordinates, of the cursor relative to the upper-left corner of the content area of the specified window. The window must have input focus. If the window does not have input focus when this function is called, it fails silently.
Do not use this function to implement things like camera controls. GLFW already provides the
CURSOR_DISABLED
cursor mode that hides the cursor, transparently re-centers it and provides unconstrained cursor motion. SeesetInputMode(java.lang.foreign.MemorySegment, int, int)
PREVIEW for more information.If the cursor mode is
CURSOR_DISABLED
then the cursor position is unconstrained and limited only by the minimum and maximum values of adouble
.- Parameters:
window
- The desired window.xpos
- The desired x-coordinate, relative to the left edge of the content area.ypos
- The desired y-coordinate, relative to the top edge of the content area.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Remarks:
- Wayland: This function will only work when the cursor mode is
CURSOR_DISABLED
, otherwise it will do nothing. - Thread safety:
- This function must only be called from the main thread.
-
ncreateCursor
Creates a custom cursor.Creates a new custom cursor image that can be set for a window with
setCursor(java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment)
PREVIEW. The cursor can be destroyed withdestroyCursor(java.lang.foreign.MemorySegment)
PREVIEW. Any remaining cursors are destroyed byterminate()
.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 cursor hotspot is specified in pixels, relative to the upper-left corner of the cursor image. Like all other coordinate systems in GLFW, the X-axis points to the right and the Y-axis points down.
- Parameters:
image
- The desired cursor image.xhot
- The desired x-coordinate, in pixels, of the cursor hotspot.yhot
- The desired y-coordinate, in pixels, of the cursor hotspot.- Returns:
- The handle of the created cursor, or
NULL
PREVIEW if an error occurred. - See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_VALUE
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The specified image data is copied before this function returns.
-
createCursor
Creates a custom cursor. -
createStandardCursor
Creates a cursor with a standard shape.Returns a cursor with a standard shape, that can be set for a window with
setCursor(java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment)
PREVIEW.- Parameters:
shape
- One of the standard shapes.- Returns:
- A new cursor ready to use or
NULL
PREVIEW if an error occurred. - See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_ENUM
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
destroyCursor
Destroys a cursor.This function destroys a cursor previously created with
createCursor(overrungl.glfw.GLFWImage, int, int)
PREVIEW. Any remaining cursors will be destroyed byterminate()
.If the specified cursor is current for any window, that window will be reverted to the default cursor. This does not affect the cursor mode.
- Parameters:
cursor
- The cursor object to destroy.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
- Reentrancy:
- This function must not be called from a callback.
-
setCursor
Sets the cursor for the window.This function sets the cursor image to be used when the cursor is over the content area of the specified window. The set cursor will only be visible when the cursor mode of the window is
CURSOR_NORMAL
.On some platforms, the set cursor may not be visible unless the window also has input focus.
- Parameters:
window
- The window to set the cursor for.cursor
- The cursor to set, orNULL
PREVIEW to switch back to the default arrow cursor.- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
nsetKeyCallback
public static MemorySegmentPREVIEW nsetKeyCallback(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the key callback.This function sets the key callback of the specified window, which is called when a key is pressed, repeated or released.
The key functions deal with physical keys, with layout independent key tokens named after their values in the standard US keyboard layout. If you want to input text, use the
character callback
PREVIEW instead.When a window loses input focus, it will generate synthetic key release events for all pressed keys. You can tell these events from user-generated events by the fact that the synthetic ones are generated after the focus loss event has been processed, i.e. after the
window focus callback
PREVIEW has been called.The scancode of a key is specific to that platform or sometimes even to that machine. Scancodes are intended to allow users to bind keys that don't have a GLFW key token. Such keys have
key
set toKEY_UNKNOWN
, their state is not saved and so it cannot be queried withgetKey(java.lang.foreign.MemorySegment, int)
PREVIEW.Sometimes GLFW needs to generate synthetic key events, in which case the scancode may be zero.
- Parameters:
window
- The window whose callback to set.callback
- The new key callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(GLFWwindow* window, int key, int scancode, int action, int mods)
function pointer type
.
-
setKeyCallback
public static MemorySegmentPREVIEW setKeyCallback(MemorySegmentPREVIEW window, @Nullable @Nullable IGLFWKeyFun callback) Sets the key callback.- Parameters:
window
- The window whose callback to set.callback
- The new key callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
nsetCharCallback
public static MemorySegmentPREVIEW nsetCharCallback(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the Unicode character callback.This function sets the character callback of the specified window, which is called when a Unicode character is input.
The character callback is intended for Unicode text input. As it deals with characters, it is keyboard layout dependent, whereas the
key callback
PREVIEW is not. Characters do not map 1:1 to physical keys, as a key may produce zero, one or more characters. If you want to know whether a specific physical key was pressed or released, see the key callback instead.The character callback behaves as system text input normally does and will not be called if modifier keys are held down that would prevent normal text input on that platform, for example a Super (Command) key on macOS or Alt key on Windows.
- Parameters:
window
- The window whose callback to set.callback
- The new callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(GLFWwindow* window, unsigned int codepoint)
function pointer type
.
-
setCharCallback
public static MemorySegmentPREVIEW setCharCallback(MemorySegmentPREVIEW window, @Nullable @Nullable IGLFWCharFun callback) Sets the Unicode character callback.- Parameters:
window
- The window whose callback to set.callback
- The new callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
nsetMouseButtonCallback
public static MemorySegmentPREVIEW nsetMouseButtonCallback(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the mouse button callback.This function sets the mouse button callback of the specified window, which is called when a mouse button is pressed or released.
When a window loses input focus, it will generate synthetic mouse button release events for all pressed mouse buttons. You can tell these events from user-generated events by the fact that the synthetic ones are generated after the focus loss event has been processed, i.e. after the
window focus callback
PREVIEW has been called.- Parameters:
window
- The window whose callback to set.callback
- The new callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(GLFWwindow* window, int button, int action, int mods)
function pointer type
.
-
setMouseButtonCallback
public static MemorySegmentPREVIEW setMouseButtonCallback(MemorySegmentPREVIEW window, @Nullable @Nullable IGLFWMouseButtonFun callback) Sets the mouse button callback.- Parameters:
window
- The window whose callback to set.callback
- The new callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
nsetCursorPosCallback
public static MemorySegmentPREVIEW nsetCursorPosCallback(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the cursor position callback.This function sets the cursor position callback of the specified window, which is called when the cursor is moved. The callback is provided with the position, in screen coordinates, relative to the upper-left corner of the content area of the window.
- Parameters:
window
- The window whose callback to set.callback
- The new callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(GLFWwindow* window, double xpos, double ypos);
function pointer type
.
-
setCursorPosCallback
public static MemorySegmentPREVIEW setCursorPosCallback(MemorySegmentPREVIEW window, @Nullable @Nullable IGLFWCursorPosFun callback) Sets the cursor position callback.- Parameters:
window
- The window whose callback to set.callback
- The new callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
nsetCursorEnterCallback
public static MemorySegmentPREVIEW nsetCursorEnterCallback(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the cursor enter/leave callback.This function sets the cursor boundary crossing callback of the specified window, which is called when the cursor enters or leaves the content area of the window.
- Parameters:
window
- The window whose callback to set.callback
- The new callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(GLFWwindow* window, int entered)
function pointer type
.
-
setCursorEnterCallback
public static MemorySegmentPREVIEW setCursorEnterCallback(MemorySegmentPREVIEW window, @Nullable @Nullable IGLFWCursorEnterFun callback) Sets the cursor enter/leave callback.- Parameters:
window
- The window whose callback to set.callback
- The new callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
nsetScrollCallback
public static MemorySegmentPREVIEW nsetScrollCallback(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the scroll callback.This function sets the scroll callback of the specified window, which is called when a scrolling device is used, such as a mouse wheel or scrolling area of a touchpad.
The scroll callback receives all scrolling input, like that from a mouse wheel or a touchpad scrolling area.
- Parameters:
window
- The window whose callback to set.callback
- The new scroll callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(GLFWwindow* window, double xoffset, double yoffset)
function pointer type
.
-
setScrollCallback
public static MemorySegmentPREVIEW setScrollCallback(MemorySegmentPREVIEW window, @Nullable @Nullable IGLFWScrollFun callback) Sets the scroll callback.- Parameters:
window
- The window whose callback to set.callback
- The new scroll callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
nsetDropCallback
public static MemorySegmentPREVIEW nsetDropCallback(MemorySegmentPREVIEW window, MemorySegmentPREVIEW callback) Sets the path drop callback.This function sets the path drop callback of the specified window, which is called when one or more dragged paths are dropped on the window.
Because the path array and its strings may have been generated specifically for that event, they are not guaranteed to be valid after the callback has returned. If you wish to use them after the callback returns, you need to make a deep copy.
- Parameters:
window
- The window whose callback to set.callback
- The new file drop callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Remarks:
- Wayland: File drop is currently unimplemented.
- Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(GLFWwindow* window, int path_count, const char* paths[])
function pointer type
.
-
setDropCallback
public static MemorySegmentPREVIEW setDropCallback(MemorySegmentPREVIEW window, @Nullable @Nullable IGLFWDropFun callback) Sets the path drop callback.- Parameters:
window
- The window whose callback to set.callback
- The new file drop callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
joystickPresent
public static boolean joystickPresent(int jid) Returns whether the specified joystick is present.This function returns whether the specified joystick is present.
There is no need to call this function before other functions that accept a joystick ID, as they all check for presence before performing any other work.
- Parameters:
jid
- The joystick to query.- Returns:
true
if the joystick is present, orfalse
otherwise.- Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_ENUM
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
-
ngetJoystickAxes
Returns the values of all axes of the specified joystick.This function returns the values of all axes of the specified joystick. Each element in the array is a value between -1.0 and 1.0.
If the specified joystick is not present this function will return
NULL
PREVIEW but will not generate an error. This can be used instead of first callingjoystickPresent(int)
.- Parameters:
jid
- The joystick to query.count
- Where to store the number of axis values in the returned array. This is set to zero if the joystick is not present or an error occurred.- Returns:
- An array of axis values, or
NULL
PREVIEW if the joystick is not present or an error occurred. - Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_ENUM
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The returned array is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified joystick is disconnected or the library is terminated.
-
getJoystickAxes
public static float @Nullable [] getJoystickAxes(int jid) Returns the values of all axes of the specified joystick. -
ngetJoystickButtons
Returns the state of all buttons of the specified joystick.This function returns the state of all buttons of the specified joystick. Each element in the array is either
PRESS
orRELEASE
.For backward compatibility with earlier versions that did not have
ngetJoystickHats(int, java.lang.foreign.MemorySegment)
PREVIEW, the button array also includes all hats, each represented as four buttons. The hats are in the same order as returned by getJoystickHats and are in the order up, right, down and left. To disable these extra buttons, set theJOYSTICK_HAT_BUTTONS
init hint before initialization.If the specified joystick is not present this function will return
NULL
PREVIEW but will not generate an error. This can be used instead of first callingjoystickPresent(int)
.- Parameters:
jid
- The joystick to query.count
- Where to store the number of button states in the returned array. This is set to zero if the joystick is not present or an error occurred.- Returns:
- An array of button states, or
NULL
PREVIEW if the joystick is not present or an error occurred. - Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_ENUM
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The returned array is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified joystick is disconnected or the library is terminated.
-
getJoystickButtons
public static boolean @Nullable [] getJoystickButtons(int jid) Returns the state of all buttons of the specified joystick. -
ngetJoystickHats
Returns the state of all hats of the specified joystick.This function returns the state of all hats of the specified joystick. Each element in the array is one of the following values:
Values Table Name Value HAT_CENTERED
0 HAT_UP
1 HAT_RIGHT
2 HAT_DOWN
4 HAT_LEFT
8 HAT_RIGHT_UP
HAT_RIGHT | HAT_UP
HAT_RIGHT_DOWN
HAT_RIGHT | HAT_DOWN
HAT_LEFT_UP
HAT_LEFT | HAT_UP
HAT_LEFT_DOWN
HAT_LEFT | HAT_DOWN
The diagonal directions are bitwise combinations of the primary (up, right, down and left) directions, and you can test for these individually by ANDing it with the corresponding direction.
if (hats[2] & HAT_RIGHT) { // State of hat 2 could be right-up, right or right-down }
If the specified joystick is not present this function will return
NULL
PREVIEW but will not generate an error. This can be used instead of first callingjoystickPresent(int)
.- Parameters:
jid
- The joystick to query.count
- Where to store the number of hat states in the returned array. This is set to zero if the joystick is not present or an error occurred.- Returns:
- An array of hat states, or
NULL
PREVIEW if the joystick is not present or an error occurred. - Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_ENUM
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The returned array is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified joystick is disconnected, this function is called again for that joystick or the library is terminated.
-
getJoystickHats
public static byte[] getJoystickHats(int jid) Returns the state of all hats of the specified joystick. -
ngetJoystickName
Returns the name of the specified joystick.This function returns the name, encoded as UTF-8, of the specified joystick. The returned string is allocated and freed by GLFW. You should not free it yourself.
If the specified joystick is not present this function will return
NULL
PREVIEW but will not generate an error. This can be used instead of first callingjoystickPresent(int)
.- Parameters:
jid
- The joystick to query.- Returns:
- The UTF-8 encoded name of the joystick, or
NULL
PREVIEW if the joystick is not present or an error occurred. - Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_ENUM
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The returned string is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified joystick is disconnected or the library is terminated.
-
getJoystickName
Returns the name of the specified joystick. -
ngetJoystickGUID
Returns the SDL compatible GUID of the specified joystick.This function returns the SDL compatible GUID, as a UTF-8 encoded hexadecimal string, of the specified joystick. The returned string is allocated and freed by GLFW. You should not free it yourself.
The GUID is what connects a joystick to a gamepad mapping. A connected joystick will always have a GUID even if there is no gamepad mapping assigned to it.
If the specified joystick is not present this function will return
NULL
PREVIEW but will not generate an error. This can be used instead of first callingjoystickPresent(int)
.The GUID uses the format introduced in SDL 2.0.5. This GUID tries to uniquely identify the make and model of a joystick but does not identify a specific unit, e.g. all wired Xbox 360 controllers will have the same GUID on that platform. The GUID for a unit may vary between platforms depending on what hardware information the platform specific APIs provide.
- Parameters:
jid
- The joystick to query.- Returns:
- The UTF-8 encoded GUID of the joystick, or
NULL
PREVIEW if the joystick is not present or an error occurred. - Errors:
- Possible errors include
NOT_INITIALIZED
,INVALID_ENUM
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The returned string is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified joystick is disconnected or the library is terminated.
-
getJoystickGUID
Returns the SDL compatible GUID of the specified joystick. -
setJoystickUserPointer
Sets the user pointer of the specified joystick.This function sets the user-defined pointer of the specified joystick. The current value is retained until the joystick is disconnected. The initial value is
NULL
PREVIEW.This function may be called from the joystick callback, even for a joystick that is being disconnected.
- Parameters:
jid
- The joystick whose pointer to set.pointer
- The new value.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function may be called from any thread. Access is not synchronized.
-
getJoystickUserPointer
Returns the user pointer of the specified joystick.This function returns the current value of the user-defined pointer of the specified joystick. The initial value is
NULL
PREVIEW.This function may be called from the joystick callback, even for a joystick that is being disconnected.
- Parameters:
jid
- The joystick whose pointer to return.- Returns:
- the user pointer of the specified joystick
- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function may be called from any thread. Access is not synchronized.
-
joystickIsGamepad
public static boolean joystickIsGamepad(int jid) Returns whether the specified joystick has a gamepad mapping.This function returns whether the specified joystick is both present and has a gamepad mapping.
If the specified joystick is present but does not have a gamepad mapping this function will return
false
but will not generate an error. CalljoystickPresent(int)
to check if a joystick is present regardless of whether it has a mapping.- Parameters:
jid
- The joystick to query.- Returns:
true
if a joystick is both present and has a gamepad mapping, orfalse
otherwise.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andINVALID_ENUM
. - Thread safety:
- This function must only be called from the main thread.
-
nsetJoystickCallback
Sets the joystick configuration callback.This function sets the joystick configuration callback, or removes the currently set callback. This is called when a joystick is connected to or disconnected from the system.
For joystick connection and disconnection events to be delivered on all platforms, you need to call one of the event processing functions. Joystick disconnection may also be detected and the callback called by joystick functions. The function will then return whatever it returns if the joystick is not present.
- Parameters:
callback
- The new callback, orNULL
PREVIEW to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function must only be called from the main thread.
- Callback signature:
For more information about the callback parameters, see thevoid function_name(int jid, int event)
function pointer type
.
-
setJoystickCallback
public static MemorySegmentPREVIEW setJoystickCallback(@Nullable @Nullable IGLFWJoystickFun callback) Sets the joystick configuration callback.- Parameters:
callback
- The new callback, ornull
to remove the currently set callback.- Returns:
- The previously set callback, or
NULL
PREVIEW if no callback was set or the library had not been initialized. - See Also:
-
nupdateGamepadMappings
Adds the specified SDL_GameControllerDB gamepad mappings.This function parses the specified ASCII encoded string and updates the internal list with any gamepad mappings it finds. This string may contain either a single gamepad mapping or many mappings separated by newlines. The parser supports the full format of the
gamecontrollerdb.txt
source file including empty lines and comments.See Gamepad mappings for a description of the format.
If there is already a gamepad mapping for a given GUID in the internal list, it will be replaced by the one passed to this function. If the library is terminated and re-initialized the internal list will revert to the built-in default.
- Parameters:
string
- The string containing the gamepad mappings.- Returns:
true
if successful, orfalse
if an error occurred.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andINVALID_VALUE
. - Thread safety:
- This function must only be called from the main thread.
-
updateGamepadMappings
Adds the specified SDL_GameControllerDB gamepad mappings.- Parameters:
string
- The string containing the gamepad mappings.- Returns:
true
if successful, orfalse
if an error occurred.- See Also:
-
ngetGamepadName
Returns the human-readable gamepad name for the specified joystick.This function returns the human-readable name of the gamepad from the gamepad mapping assigned to the specified joystick.
If the specified joystick is not present or does not have a gamepad mapping this function will return
NULL
PREVIEW but will not generate an error. CalljoystickPresent(int)
to check whether it is present regardless of whether it has a mapping.- Parameters:
jid
- The joystick to query.- Returns:
- The UTF-8 encoded name of the gamepad, or
NULL
PREVIEW if the joystick is not present, does not have a mapping or an error occurred. - See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andINVALID_ENUM
. - Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The returned string is allocated and freed by GLFW. You should not free it yourself. It is valid until the specified joystick is disconnected, the gamepad mappings are updated or the library is terminated.
-
getGamepadName
Returns the human-readable gamepad name for the specified joystick. -
ngetGamepadState
Retrieves the state of the specified joystick remapped as a gamepad.This function retrieves the state of the specified joystick remapped to an Xbox-like gamepad.
If the specified joystick is not present or does not have a gamepad mapping this function will return
false
but will not generate an error. CalljoystickPresent(int)
to check whether it is present regardless of whether it has a mapping.The Guide button may not be available for input as it is often hooked by the system or the Steam client.
Not all devices have all the buttons or axes provided by
GLFWGamepadState
. Unavailable buttons and axes will always reportRELEASE
and 0.0 respectively.- Parameters:
jid
- The joystick to query.state
- The gamepad input state of the joystick.- Returns:
true
if successful, orfalse
if no joystick is connected, it has no gamepad mapping or an error occurred.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andINVALID_ENUM
. - Thread safety:
- This function must only be called from the main thread.
-
getGamepadState
Retrieves the state of the specified joystick remapped as a gamepad. -
nsetClipboardString
Sets the clipboard to the specified string.This function sets the system clipboard to the specified, UTF-8 encoded string.
- Parameters:
string
- A UTF-8 encoded string.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The specified string is copied before this function returns.
-
setClipboardString
Sets the clipboard to the specified string.- Parameters:
string
- A UTF-8 encoded string.- See Also:
-
ngetClipboardString
Returns the contents of the clipboard as a string.This function returns the contents of the system clipboard, if it contains or is convertible to a UTF-8 encoded string. If the clipboard is empty or if its contents cannot be converted,
NULL
PREVIEW is returned and aFORMAT_UNAVAILABLE
error is generated.- Returns:
- The contents of the clipboard as a UTF-8 encoded string, or
NULL
PREVIEW if an error occurred. - See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
,FORMAT_UNAVAILABLE
andPLATFORM_ERROR
. - Thread safety:
- This function must only be called from the main thread.
- Pointer lifetime:
- The returned string is allocated and freed by GLFW. You
should not free it yourself. It is valid until the next call to
getClipboardString
orsetClipboardString
PREVIEW, or until the library is terminated.
-
getClipboardString
@Nullable public static @Nullable String getClipboardString(@Deprecated MemorySegmentPREVIEW window) Returns the contents of the clipboard as a string.- Returns:
- The contents of the clipboard as a UTF-8 encoded string, or
null
if an error occurred. - See Also:
-
getTime
public static double getTime()Returns the GLFW time.This function returns the current GLFW time, in seconds. Unless the time has been set using
setTime(double)
it measures time elapsed since GLFW was initialized.This function and
setTime(double)
are helper functions on top ofgetTimerFrequency()
andgetTimerValue()
.The resolution of the timer is system dependent, but is usually on the order of a few micro- or nanoseconds. It uses the highest-resolution monotonic time source on each supported platform.
- Returns:
- The current time, in seconds, or zero if an error occurred.
- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function may be called from any thread. Reading and
writing of the internal base time is not atomic, so it needs to be
externally synchronized with calls to
setTime(double)
.
-
setTime
public static void setTime(double time) Sets the GLFW time.This function sets the current GLFW time, in seconds. The value must be a positive finite number less than or equal to 18446744073.0, which is approximately 584.5 years.
This function and
getTime()
are helper functions on top ofgetTimerFrequency()
andgetTimerValue()
.- Parameters:
time
- The new value, in seconds.- Errors:
- Possible errors include
NOT_INITIALIZED
andINVALID_VALUE
. - Remarks:
- The upper limit of GLFW time is calculated as floor((264 - 1) / 109) and is due to implementations storing nanoseconds in 64 bits. The limit may be increased in the future.
- Thread safety:
- This function may be called from any thread. Reading and
writing of the internal base time is not atomic, so it needs to be
externally synchronized with calls to
getTime()
.
-
getTimerValue
public static long getTimerValue()Returns the current value of the raw timer.This function returns the current value of the raw timer, measured in 1 / frequency seconds. To get the frequency, call
getTimerFrequency()
.- Returns:
- The value of the timer, or zero if an error occurred.
- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function may be called from any thread.
-
getTimerFrequency
public static long getTimerFrequency()Returns the frequency, in Hz, of the raw timer.This function returns the frequency, in Hz, of the raw timer.
- Returns:
- The frequency of the timer, in Hz, or zero if an error occurred.
- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function may be called from any thread.
-
makeContextCurrent
Makes the context of the specified window current for the calling thread.This function makes the OpenGL or OpenGL ES context of the specified window current on the calling thread. A context must only be made current on a single thread at a time and each thread can have only a single current context at a time.
When moving a context between threads, you must make it non-current on the old thread before making it current on the new one.
By default, making a context non-current implicitly forces a pipeline flush. On machines that support
GL_KHR_context_flush_control
, you can control whether a context performs this flush by setting theCONTEXT_RELEASE_BEHAVIOR
hint.The specified window must have an OpenGL or OpenGL ES context. Specifying a window without a context will generate a
NO_WINDOW_CONTEXT
error.- Parameters:
window
- The window whose context to make current, orNULL
PREVIEW to detach the current context.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
,NO_WINDOW_CONTEXT
andPLATFORM_ERROR
. - Thread safety:
- This function may be called from any thread.
-
getCurrentContext
Returns the window whose context is current on the calling thread.This function returns the window whose OpenGL or OpenGL ES context is current on the calling thread.
- Returns:
- The window whose context is current, or
NULL
PREVIEW if no window's context is current. - See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function may be called from any thread.
-
swapBuffers
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
NO_WINDOW_CONTEXT
error.This function does not apply to Vulkan. If you are rendering with Vulkan, see
vkQueuePresentKHR
instead.- Parameters:
window
- The window whose buffers to swap.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
,NO_WINDOW_CONTEXT
andPLATFORM_ERROR
. - Remarks:
- EGL: The context of the specified window must be current on the calling thread.
- Thread safety:
- This function may be called from any thread.
-
swapInterval
public static void swapInterval(int interval) Sets the swap interval for the current context.This function sets the swap interval for the current OpenGL or OpenGL ES context, i.e. the number of screen updates to wait from the time @ref glfwSwapBuffers was called before swapping the buffers and returning. This is sometimes called vertical synchronization, vertical retrace synchronization or just vsync.
A context that supports either of the
WGL_EXT_swap_control_tear
andGLX_EXT_swap_control_tear
extensions also accepts negative swap intervals, which allows the driver to swap immediately even if a frame arrives a little bit late. You can check for these extensions withextensionSupported(java.lang.String)
.A context must be current on the calling thread. Calling this function without a current context will cause a
NO_CURRENT_CONTEXT
error.This function does not apply to Vulkan. If you are rendering with Vulkan, see the present mode of your swapchain instead.
- Parameters:
interval
- The minimum number of screen updates to wait for until the buffers are swapped byswapBuffers(java.lang.foreign.MemorySegment)
PREVIEW.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
,NO_CURRENT_CONTEXT
andPLATFORM_ERROR
. - Remarks:
- This function is not called during context creation, leaving the swap interval set to whatever is the default on that platform. This is done because some swap interval extensions used by GLFW do not allow the swap interval to be reset to zero once it has been set to a non-zero value., Some GPU drivers do not honor the requested swap interval, either because of a user setting that overrides the application's request or due to bugs in the driver.
- Thread safety:
- This function may be called from any thread.
-
nextensionSupported
Returns whether the specified extension is available.This function returns whether the specified API extension is supported by the current OpenGL or OpenGL ES context. It searches both for client API extension and context creation API extensions.
A context must be current on the calling thread. Calling this function without a current context will cause a
NO_CURRENT_CONTEXT
error.As this functions retrieves and searches one or more extension strings each call, it is recommended that you cache its results if it is going to be used frequently. The extension strings will not change during the lifetime of a context, so there is no danger in doing this.
This function does not apply to Vulkan. If you are using Vulkan, see
ngetRequiredInstanceExtensions(java.lang.foreign.MemorySegment)
PREVIEW,vkEnumerateInstanceExtensionProperties
andvkEnumerateDeviceExtensionProperties
instead.- Parameters:
extension
- The ASCII encoded name of the extension.- Returns:
true
if the extension is available, orfalse
otherwise.- See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
,NO_CURRENT_CONTEXT
,INVALID_VALUE
andPLATFORM_ERROR
. - Thread safety:
- This function may be called from any thread.
-
extensionSupported
Returns whether the specified extension is available.- Parameters:
extension
- The ASCII encoded name of the extension.- Returns:
true
if the extension is available, orfalse
otherwise.- See Also:
-
ngetProcAddress
Returns the address of the specified function for the current context.This function returns the address of the specified OpenGL or OpenGL ES core or extension function, if it is supported by the current context.
A context must be current on the calling thread. Calling this function without a current context will cause a
NO_CURRENT_CONTEXT
error.This function does not apply to Vulkan. If you are rendering with Vulkan, see
glfwGetInstanceProcAddress
PREVIEW,vkGetInstanceProcAddr
andvkGetDeviceProcAddr
instead.- Parameters:
procName
- The ASCII encoded name of the function.- Returns:
- The address of the function, or
NULL
PREVIEW if an error occurred. - See Also:
- Errors:
- Possible errors include
NOT_INITIALIZED
,NO_CURRENT_CONTEXT
andPLATFORM_ERROR
. - Remarks:
- The address of a given function is not guaranteed to be the same
between contexts.
This function may return a non-
NULL
PREVIEW address despite the associated version or extension not being available. Always check the context version or extension string first. - Thread safety:
- This function may be called from any thread.
- Pointer lifetime:
- The returned function pointer is valid until the context is destroyed or the library is terminated.
-
getProcAddress
Returns the address of the specified function for the current context. -
vulkanSupported
public static boolean vulkanSupported()Returns whether the Vulkan loader and an ICD have been found.This function returns whether the Vulkan loader and any minimally functional ICD have been found.
The availability of a Vulkan loader and even an ICD does not by itself guarantee that surface creation or even instance creation is possible. Call
getRequiredInstanceExtensions
PREVIEW to check whether the extensions necessary for Vulkan surface creation are available andglfwGetPhysicalDevicePresentationSupport
PREVIEW to check whether a queue family of a physical device supports image presentation.- Returns:
true
if Vulkan is minimally available, orfalse
otherwise.- Errors:
- Possible errors include
NOT_INITIALIZED
. - Thread safety:
- This function may be called from any thread.
-
ngetRequiredInstanceExtensions
Returns the Vulkan instance extensions required by GLFW.This function returns an array of names of Vulkan instance extensions required by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the list will always contain
VK_KHR_surface
, so if you don't require any additional extensions you can pass this list directly to theVkInstanceCreateInfo
struct.If Vulkan is not available on the machine, this function returns
NULL
PREVIEW and generates aAPI_UNAVAILABLE
error. CallvulkanSupported()
to check whether Vulkan is at least minimally available.If Vulkan is available but no set of extensions allowing window surface creation was found, this function returns
NULL
PREVIEW. You may still use Vulkan for off-screen rendering and compute work.- Parameters:
count
- Where to store the number of extensions in the returned array. This is set to zero if an error occurred.- Returns:
- An array of ASCII encoded extension names, or
NULL
PREVIEW if an error occurred. - Errors:
- Possible errors include
NOT_INITIALIZED
andAPI_UNAVAILABLE
. - Remarks:
- Additional extensions may be required by future versions of GLFW.
You should check if any extensions you wish to enable are already in the
returned array, as it is an error to specify an extension more than once in
the
VkInstanceCreateInfo
struct. - Thread safety:
- This function may be called from any thread.
- Pointer lifetime:
- The returned array is allocated and freed by GLFW. You should not free it yourself. It is guaranteed to be valid only until the library is terminated.
-
getRequiredInstanceExtensions
Returns the Vulkan instance extensions required by GLFW.
-
GLFW
when preview features are enabled.