Class GLFW
- java.lang.Object
-
- org.lwjgl.glfw.GLFW
-
public class GLFW extends java.lang.Object
Native bindings to the GLFW library.GLFW is a free, Open Source, multi-platform library for opening a window, creating an OpenGL context and managing input. It is easy to integrate into existing applications and does not lay claim to the main loop.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
GLFW.Functions
Contains the function pointers loaded from the glfwSharedLibrary
.
-
Field Summary
Fields Modifier and Type Field and Description static int
GLFW_ACCUM_ALPHA_BITS
GLFW_ACCUM_BLUE_BITS
GLFW_ACCUM_GREEN_BITS
GLFW_ACCUM_RED_BITS
GLFW_ALPHA_BITSPixelFormat hints.static int
GLFW_ANY_RELEASE_BEHAVIOR
Values for theCONTEXT_RELEASE_BEHAVIOR
hint.static int
GLFW_API_UNAVAILABLE
GLFW could not find support for the requested API on the system.static int
GLFW_ARROW_CURSOR
Standard cursor shapes.static int
GLFW_AUTO_ICONIFY
WindowHint
: Specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss.static int
GLFW_AUX_BUFFERS
GLFW_BLUE_BITSPixelFormat hints.static int
GLFW_CLIENT_API
WindowHint
: Specifies which client API to create the context for.static int
GLFW_CONNECTED
Monitor events.static int
GLFW_CONTEXT_CREATION_API
WindowHint
: Specifies which context creation API to use to create the context.static int
GLFW_CONTEXT_NO_ERROR
WindowHint
: Specifies whether errors should be generated by the context.static int
GLFW_CONTEXT_RELEASE_BEHAVIOR
WindowHint
: Specifies the release behavior to be used by the context.static int
GLFW_CONTEXT_REVISION
GetWindowAttrib
: Indicates the client API version of the window's context.static int
GLFW_CONTEXT_ROBUSTNESS
WindowHint
: Specifies the robustness strategy to be used by the context.static int
GLFW_CONTEXT_VERSION_MAJOR
WindowHint
: Specifies the client API major version that the created context must be compatible with.static int
GLFW_CONTEXT_VERSION_MINOR
WindowHint
: Specifies the client API minor version that the created context must be compatible with.static int
GLFW_CROSSHAIR_CURSOR
Standard cursor shapes.static int
GLFW_CURSOR
Input options.static int
GLFW_CURSOR_DISABLED
GLFW_CURSOR_HIDDEN
GLFW_CURSOR_NORMALCursor state.static int
GLFW_DECORATED
WindowHint
: Specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc.static int
GLFW_DEPTH_BITS
PixelFormat hints.static int
GLFW_DISCONNECTED
Monitor events.static int
GLFW_DONT_CARE
Don't care value.static int
GLFW_DOUBLEBUFFER
PixelFormat hints.static int
GLFW_EGL_CONTEXT_API
Values for theCONTEXT_CREATION_API
hint.static int
GLFW_FALSE
Boolean values.static int
GLFW_FLOATING
WindowHint
: Specifies whether the windowed mode window will be floating above other regular windows, also called topmost or always-on-top.static int
GLFW_FOCUSED
WindowHint
: Specifies whether the windowed mode window will be given input focus when created.static int
GLFW_FORMAT_UNAVAILABLE
The requested format is not supported or available.static int
GLFW_GREEN_BITS
PixelFormat hints.static int
GLFW_HAND_CURSOR
GLFW_HRESIZE_CURSOR
GLFW_IBEAM_CURSORStandard cursor shapes.static int
GLFW_ICONIFIED
GetWindowAttrib
: Indicates whether the specified window is iconified, whether by the user or withIconifyWindow
.static int
GLFW_INVALID_ENUM
One of the arguments to the function was an invalid enum value.static int
GLFW_INVALID_VALUE
One of the arguments to the function was an invalid value.static int
GLFW_JOYSTICK_1
GLFW_JOYSTICK_10
GLFW_JOYSTICK_11
GLFW_JOYSTICK_12
GLFW_JOYSTICK_13
GLFW_JOYSTICK_14
GLFW_JOYSTICK_15
GLFW_JOYSTICK_16
GLFW_JOYSTICK_2
GLFW_JOYSTICK_3
GLFW_JOYSTICK_4
GLFW_JOYSTICK_5
GLFW_JOYSTICK_6
GLFW_JOYSTICK_7
GLFW_JOYSTICK_8
GLFW_JOYSTICK_9
GLFW_JOYSTICK_LASTJoysticks.static int
GLFW_KEY_0
GLFW_KEY_1
GLFW_KEY_2
GLFW_KEY_3
GLFW_KEY_4
GLFW_KEY_5
GLFW_KEY_6
GLFW_KEY_7
GLFW_KEY_8
GLFW_KEY_9
GLFW_KEY_A
GLFW_KEY_APOSTROPHE
GLFW_KEY_B
GLFW_KEY_BACKSLASHPrintable keys.static int
GLFW_KEY_BACKSPACE
Function keys.static int
GLFW_KEY_C
Printable keys.static int
GLFW_KEY_CAPS_LOCK
Function keys.static int
GLFW_KEY_COMMA
GLFW_KEY_DPrintable keys.static int
GLFW_KEY_DELETE
GLFW_KEY_DOWNFunction keys.static int
GLFW_KEY_E
Printable keys.static int
GLFW_KEY_END
GLFW_KEY_ENTERFunction keys.static int
GLFW_KEY_EQUAL
Printable keys.static int
GLFW_KEY_ESCAPE
Function keys.static int
GLFW_KEY_F
Printable keys.static int
GLFW_KEY_F1
GLFW_KEY_F10
GLFW_KEY_F11
GLFW_KEY_F12
GLFW_KEY_F13
GLFW_KEY_F14
GLFW_KEY_F15
GLFW_KEY_F16
GLFW_KEY_F17
GLFW_KEY_F18
GLFW_KEY_F19
GLFW_KEY_F2
GLFW_KEY_F20
GLFW_KEY_F21
GLFW_KEY_F22
GLFW_KEY_F23
GLFW_KEY_F24
GLFW_KEY_F25
GLFW_KEY_F3
GLFW_KEY_F4
GLFW_KEY_F5
GLFW_KEY_F6
GLFW_KEY_F7
GLFW_KEY_F8
GLFW_KEY_F9Function keys.static int
GLFW_KEY_G
GLFW_KEY_GRAVE_ACCENT
GLFW_KEY_HPrintable keys.static int
GLFW_KEY_HOME
Function keys.static int
GLFW_KEY_I
Printable keys.static int
GLFW_KEY_INSERT
Function keys.static int
GLFW_KEY_J
GLFW_KEY_KPrintable keys.static int
GLFW_KEY_KP_0
GLFW_KEY_KP_1
GLFW_KEY_KP_2
GLFW_KEY_KP_3
GLFW_KEY_KP_4
GLFW_KEY_KP_5
GLFW_KEY_KP_6
GLFW_KEY_KP_7
GLFW_KEY_KP_8
GLFW_KEY_KP_9
GLFW_KEY_KP_ADD
GLFW_KEY_KP_DECIMAL
GLFW_KEY_KP_DIVIDE
GLFW_KEY_KP_ENTER
GLFW_KEY_KP_EQUAL
GLFW_KEY_KP_MULTIPLY
GLFW_KEY_KP_SUBTRACTFunction keys.static int
GLFW_KEY_L
Printable keys.static int
GLFW_KEY_LAST
GLFW_KEY_LEFT
GLFW_KEY_LEFT_ALTFunction keys.static int
GLFW_KEY_LEFT_BRACKET
Printable keys.static int
GLFW_KEY_LEFT_CONTROL
GLFW_KEY_LEFT_SHIFT
GLFW_KEY_LEFT_SUPERFunction keys.static int
GLFW_KEY_M
Printable keys.static int
GLFW_KEY_MENU
Function keys.static int
GLFW_KEY_MINUS
GLFW_KEY_NPrintable keys.static int
GLFW_KEY_NUM_LOCK
Function keys.static int
GLFW_KEY_O
GLFW_KEY_PPrintable keys.static int
GLFW_KEY_PAGE_DOWN
GLFW_KEY_PAGE_UP
GLFW_KEY_PAUSEFunction keys.static int
GLFW_KEY_PERIOD
Printable keys.static int
GLFW_KEY_PRINT_SCREEN
Function keys.static int
GLFW_KEY_Q
GLFW_KEY_RPrintable keys.static int
GLFW_KEY_RIGHT
GLFW_KEY_RIGHT_ALTFunction keys.static int
GLFW_KEY_RIGHT_BRACKET
Printable keys.static int
GLFW_KEY_RIGHT_CONTROL
GLFW_KEY_RIGHT_SHIFT
GLFW_KEY_RIGHT_SUPERFunction keys.static int
GLFW_KEY_S
Printable keys.static int
GLFW_KEY_SCROLL_LOCK
Function keys.static int
GLFW_KEY_SEMICOLON
GLFW_KEY_SLASH
GLFW_KEY_SPACE
GLFW_KEY_TPrintable keys.static int
GLFW_KEY_TAB
Function keys.static int
GLFW_KEY_U
Printable keys.static int
GLFW_KEY_UNKNOWN
The unknown key.static int
GLFW_KEY_UP
Function keys.static int
GLFW_KEY_V
GLFW_KEY_W
GLFW_KEY_WORLD_1
GLFW_KEY_WORLD_2
GLFW_KEY_X
GLFW_KEY_Y
GLFW_KEY_ZPrintable keys.static int
GLFW_LOSE_CONTEXT_ON_RESET
Values for theCONTEXT_ROBUSTNESS
hint.static int
GLFW_MAXIMIZED
WindowHint
: Specifies whether the windowed mode window will be maximized when created.static int
GLFW_MOD_ALT
If this bit is set one or more Alt keys were held down.static int
GLFW_MOD_CONTROL
If this bit is set one or more Control keys were held down.static int
GLFW_MOD_SHIFT
If this bit is set one or more Shift keys were held down.static int
GLFW_MOD_SUPER
If this bit is set one or more Super keys were held down.static int
GLFW_MOUSE_BUTTON_1
GLFW_MOUSE_BUTTON_2
GLFW_MOUSE_BUTTON_3
GLFW_MOUSE_BUTTON_4
GLFW_MOUSE_BUTTON_5
GLFW_MOUSE_BUTTON_6
GLFW_MOUSE_BUTTON_7
GLFW_MOUSE_BUTTON_8
GLFW_MOUSE_BUTTON_LAST
GLFW_MOUSE_BUTTON_LEFT
GLFW_MOUSE_BUTTON_MIDDLE
GLFW_MOUSE_BUTTON_RIGHTMouse buttons.static int
GLFW_NATIVE_CONTEXT_API
Values for theCONTEXT_CREATION_API
hint.static int
GLFW_NO_API
Values for theCLIENT_API
hint.static int
GLFW_NO_CURRENT_CONTEXT
No context is current for this thread.static int
GLFW_NO_RESET_NOTIFICATION
GLFW_NO_ROBUSTNESSValues for theCONTEXT_ROBUSTNESS
hint.static int
GLFW_NO_WINDOW_CONTEXT
The specified window does not have an OpenGL or OpenGL ES context.static int
GLFW_NOT_INITIALIZED
GLFW has not been initialized.static int
GLFW_OPENGL_ANY_PROFILE
Values for theOPENGL_PROFILE
hint.static int
GLFW_OPENGL_API
Values for theCLIENT_API
hint.static int
GLFW_OPENGL_COMPAT_PROFILE
GLFW_OPENGL_CORE_PROFILEValues for theOPENGL_PROFILE
hint.static int
GLFW_OPENGL_DEBUG_CONTEXT
WindowHint
: Specifies whether to create a debug OpenGL context, which may have additional error and performance issue reporting functionality.static int
GLFW_OPENGL_ES_API
Values for theCLIENT_API
hint.static int
GLFW_OPENGL_FORWARD_COMPAT
WindowHint
: Specifies whether the OpenGL context should be forward-compatible, i.e.static int
GLFW_OPENGL_PROFILE
WindowHint
: Specifies which OpenGL profile to create the context for.static int
GLFW_OUT_OF_MEMORY
A memory allocation failed.static int
GLFW_PLATFORM_ERROR
A platform-specific error occurred that does not match any of the more specific categories.static int
GLFW_PRESS
The key or button was pressed.static int
GLFW_RED_BITS
GLFW_REFRESH_RATEPixelFormat hints.static int
GLFW_RELEASE
The key or button was released.static int
GLFW_RELEASE_BEHAVIOR_FLUSH
GLFW_RELEASE_BEHAVIOR_NONEValues for theCONTEXT_RELEASE_BEHAVIOR
hint.static int
GLFW_REPEAT
The key was held down until it repeated.static int
GLFW_RESIZABLE
WindowHint
: Specifies whether the windowed mode window will be resizable by the user.static int
GLFW_SAMPLES
GLFW_SRGB_CAPABLE
GLFW_STENCIL_BITS
GLFW_STEREOPixelFormat hints.static int
GLFW_STICKY_KEYS
GLFW_STICKY_MOUSE_BUTTONSInput options.static int
GLFW_TRUE
Boolean values.static int
GLFW_VERSION_MAJOR
The major version number of the GLFW library.static int
GLFW_VERSION_MINOR
The minor version number of the GLFW library.static int
GLFW_VERSION_REVISION
The revision number of the GLFW library.static int
GLFW_VERSION_UNAVAILABLE
The requested OpenGL or OpenGL ES version (including any requested context or framebuffer hints) is not available on this machine.static int
GLFW_VISIBLE
WindowHint
: Specifies whether the windowed mode window will be initially visible.static int
GLFW_VRESIZE_CURSOR
Standard cursor shapes.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static SharedLibrary
getLibrary()
Returns the glfwSharedLibrary
.static long
glfwCreateCursor(GLFWImage image, int xhot, int yhot)
Creates a new custom cursor image that can be set for a window withSetCursor
.static long
glfwCreateStandardCursor(int shape)
Returns a cursor with a standard shape, that can be set for a window withSetCursor
.static long
glfwCreateWindow(int width, int height, java.nio.ByteBuffer title, long monitor, long share)
Creates a window and its associated OpenGL or OpenGL ES context.static long
glfwCreateWindow(int width, int height, java.lang.CharSequence title, long monitor, long share)
Creates a window and its associated OpenGL or OpenGL ES context.static void
glfwDefaultWindowHints()
Resets all window hints to their default values.static void
glfwDestroyCursor(long cursor)
Destroys a cursor previously created withCreateCursor
.static void
glfwDestroyWindow(long window)
Destroys the specified window and its context.static boolean
glfwExtensionSupported(java.nio.ByteBuffer extension)
Returns whether the specified API extension is supported by the current OpenGL or OpenGL ES context.static boolean
glfwExtensionSupported(java.lang.CharSequence extension)
Returns whether the specified API extension is supported by the current OpenGL or OpenGL ES context.static void
glfwFocusWindow(long window)
Brings the specified window to front and sets input focus.static java.lang.String
glfwGetClipboardString(long window)
Returns the contents of the system clipboard, if it contains or is convertible to a UTF-8 encoded string.static long
glfwGetCurrentContext()
Returns the window whose OpenGL or OpenGL ES context is current on the calling thread.static void
glfwGetCursorPos(long window, double[] xpos, double[] ypos)
Array version of:GetCursorPos
static void
glfwGetCursorPos(long window, java.nio.DoubleBuffer xpos, java.nio.DoubleBuffer ypos)
Returns the position of the cursor, in screen coordinates, relative to the upper-left corner of the client area of the specified window.static void
glfwGetFramebufferSize(long window, int[] width, int[] height)
Array version of:GetFramebufferSize
static void
glfwGetFramebufferSize(long window, java.nio.IntBuffer width, java.nio.IntBuffer height)
Retrieves the size, in pixels, of the framebuffer of the specified window.static GLFWGammaRamp
glfwGetGammaRamp(long monitor)
Returns the current gamma ramp of the specified monitor.static int
glfwGetInputMode(long window, int mode)
Returns the value of an input option for the specified window.static java.nio.FloatBuffer
glfwGetJoystickAxes(int joy)
Returns the values of all axes of the specified joystick.static java.nio.ByteBuffer
glfwGetJoystickButtons(int joy)
Returns the state of all buttons of the specified joystick.static java.lang.String
glfwGetJoystickName(int joy)
Returns the name, encoded as UTF-8, of the specified joystick.static int
glfwGetKey(long window, int key)
Returns the last state reported for the specified key to the specified window.static java.lang.String
glfwGetKeyName(int key, int scancode)
Returns the localized name of the specified printable key.static java.lang.String
glfwGetMonitorName(long monitor)
Returns a human-readable name, encoded as UTF-8, of the specified monitor.static void
glfwGetMonitorPhysicalSize(long monitor, int[] widthMM, int[] heightMM)
Array version of:GetMonitorPhysicalSize
static void
glfwGetMonitorPhysicalSize(long monitor, java.nio.IntBuffer widthMM, java.nio.IntBuffer heightMM)
Returns the size, in millimetres, of the display area of the specified monitor.static void
glfwGetMonitorPos(long monitor, int[] xpos, int[] ypos)
Array version of:GetMonitorPos
static void
glfwGetMonitorPos(long monitor, java.nio.IntBuffer xpos, java.nio.IntBuffer ypos)
Returns the position, in screen coordinates, of the upper-left corner of the specified monitor.static PointerBuffer
glfwGetMonitors()
Returns an array of handles for all currently connected monitors.static int
glfwGetMouseButton(long window, int button)
Returns the last state reported for the specified mouse button to the specified window.static long
glfwGetPrimaryMonitor()
Returns the primary monitor.static long
glfwGetProcAddress(java.nio.ByteBuffer procname)
Returns the address of the specified OpenGL or OpenGL ES core or extension function, if it is supported by the current context.static long
glfwGetProcAddress(java.lang.CharSequence procname)
Returns the address of the specified OpenGL or OpenGL ES core or extension function, if it is supported by the current context.static double
glfwGetTime()
Returns the value of the GLFW timer.static long
glfwGetTimerFrequency()
Returns the frequency, in Hz, of the raw timer.static long
glfwGetTimerValue()
Returns the current value of the raw timer.static void
glfwGetVersion(int[] major, int[] minor, int[] rev)
Array version of:GetVersion
static void
glfwGetVersion(java.nio.IntBuffer major, java.nio.IntBuffer minor, java.nio.IntBuffer rev)
Retrieves the major, minor and revision numbers of the GLFW library.static java.lang.String
glfwGetVersionString()
Returns the compile-time generated version string of the GLFW library binary.static GLFWVidMode
glfwGetVideoMode(long monitor)
Returns the current video mode of the specified monitor.static GLFWVidMode.Buffer
glfwGetVideoModes(long monitor)
Returns an array of all video modes supported by the specified monitor.static int
glfwGetWindowAttrib(long window, int attrib)
Returns the value of an attribute of the specified window or its OpenGL or OpenGL ES context.static void
glfwGetWindowFrameSize(long window, int[] left, int[] top, int[] right, int[] bottom)
Array version of:GetWindowFrameSize
static void
glfwGetWindowFrameSize(long window, java.nio.IntBuffer left, java.nio.IntBuffer top, java.nio.IntBuffer right, java.nio.IntBuffer bottom)
Retrieves the size, in screen coordinates, of each edge of the frame of the specified window.static long
glfwGetWindowMonitor(long window)
Returns the handle of the monitor that the specified window is in full screen on.static void
glfwGetWindowPos(long window, int[] xpos, int[] ypos)
Array version of:GetWindowPos
static void
glfwGetWindowPos(long window, java.nio.IntBuffer xpos, java.nio.IntBuffer ypos)
Retrieves the position, in screen coordinates, of the upper-left corner of the client area of the specified window.static void
glfwGetWindowSize(long window, int[] width, int[] height)
Array version of:GetWindowSize
static void
glfwGetWindowSize(long window, java.nio.IntBuffer width, java.nio.IntBuffer height)
Retrieves the size, in screen coordinates, of the client area of the specified window.static long
glfwGetWindowUserPointer(long window)
Returns the current value of the user-defined pointer of the specified window.static void
glfwHideWindow(long window)
Hides the specified window, if it was previously visible.static void
glfwIconifyWindow(long window)
Iconifies (minimizes) the specified window if it was previously restored.static boolean
glfwInit()
Initializes the GLFW library.static boolean
glfwJoystickPresent(int joy)
Returns whether the specified joystick is present.static void
glfwMakeContextCurrent(long window)
Makes the OpenGL or OpenGL ES context of the specified window current on the calling thread.static void
glfwMaximizeWindow(long window)
Maximizes the specified window if it was previously not maximized.static void
glfwPollEvents()
Processes all pending events.static void
glfwPostEmptyEvent()
Posts an empty event from the current thread to the main thread event queue, causingWaitEvents
to return.static void
glfwRestoreWindow(long window)
Restores the specified window if it was previously iconified (minimized) or maximized.static GLFWCharCallback
glfwSetCharCallback(long window, GLFWCharCallbackI cbfun)
Sets the character callback of the specified window, which is called when a Unicode character is input.static GLFWCharModsCallback
glfwSetCharModsCallback(long window, GLFWCharModsCallbackI cbfun)
Sets the character with modifiers callback of the specified window, which is called when a Unicode character is input regardless of what modifier keys are used.static void
glfwSetClipboardString(long window, java.nio.ByteBuffer string)
Sets the system clipboard to the specified, UTF-8 encoded string.static void
glfwSetClipboardString(long window, java.lang.CharSequence string)
Sets the system clipboard to the specified, UTF-8 encoded string.static void
glfwSetCursor(long window, long cursor)
Sets the cursor image to be used when the cursor is over the client area of the specified window.static GLFWCursorEnterCallback
glfwSetCursorEnterCallback(long window, GLFWCursorEnterCallbackI cbfun)
Sets the cursor boundary crossing callback of the specified window, which is called when the cursor enters or leaves the client area of the window.static void
glfwSetCursorPos(long window, double xpos, double ypos)
Sets the position, in screen coordinates, of the cursor relative to the upper-left corner of the client area of the specified window.static GLFWCursorPosCallback
glfwSetCursorPosCallback(long window, GLFWCursorPosCallbackI cbfun)
Sets the cursor position callback of the specified window, which is called when the cursor is moved.static GLFWDropCallback
glfwSetDropCallback(long window, GLFWDropCallbackI cbfun)
Sets the file drop callback of the specified window, which is called when one or more dragged files are dropped on the window.static GLFWErrorCallback
glfwSetErrorCallback(GLFWErrorCallbackI cbfun)
Sets the error callback, which is called with an error code and a human-readable description each time a GLFW error occurs.static GLFWFramebufferSizeCallback
glfwSetFramebufferSizeCallback(long window, GLFWFramebufferSizeCallbackI cbfun)
Sets the framebuffer resize callback of the specified window, which is called when the framebuffer of the specified window is resized.static void
glfwSetGamma(long monitor, float gamma)
Generates a 256-element gamma ramp from the specified exponent and then callsSetGammaRamp
with it.static void
glfwSetGammaRamp(long monitor, GLFWGammaRamp ramp)
Sets the current gamma ramp for the specified monitor.static void
glfwSetInputMode(long window, int mode, int value)
Sets an input option for the specified window.static GLFWJoystickCallback
glfwSetJoystickCallback(GLFWJoystickCallbackI cbfun)
Sets the joystick configuration callback, or removes the currently set callback.static GLFWKeyCallback
glfwSetKeyCallback(long window, GLFWKeyCallbackI cbfun)
Sets the key callback of the specified window, which is called when a key is pressed, repeated or released.static GLFWMonitorCallback
glfwSetMonitorCallback(GLFWMonitorCallbackI cbfun)
Sets the monitor configuration callback, or removes the currently set callback.static GLFWMouseButtonCallback
glfwSetMouseButtonCallback(long window, GLFWMouseButtonCallbackI cbfun)
Sets the mouse button callback of the specified window, which is called when a mouse button is pressed or released.static GLFWScrollCallback
glfwSetScrollCallback(long window, GLFWScrollCallbackI cbfun)
Sets the scroll callback of the specified window, which is called when a scrolling device is used.static void
glfwSetTime(double time)
Sets the value of the GLFW timer.static void
glfwSetWindowAspectRatio(long window, int numer, int denom)
Sets the required aspect ratio of the client area of the specified window.static GLFWWindowCloseCallback
glfwSetWindowCloseCallback(long window, GLFWWindowCloseCallbackI cbfun)
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.static GLFWWindowFocusCallback
glfwSetWindowFocusCallback(long window, GLFWWindowFocusCallbackI cbfun)
Sets the focus callback of the specified window, which is called when the window gains or loses input focus.static void
glfwSetWindowIcon(long window, GLFWImage.Buffer images)
Sets the icon for the specified window.static GLFWWindowIconifyCallback
glfwSetWindowIconifyCallback(long window, GLFWWindowIconifyCallbackI cbfun)
Sets the iconification callback of the specified window, which is called when the window is iconified or restored.static void
glfwSetWindowMonitor(long window, long monitor, int xpos, int ypos, int width, int height, int refreshRate)
Sets the mode, monitor, video mode and placement of a window.static void
glfwSetWindowPos(long window, int xpos, int ypos)
Sets the position, in screen coordinates, of the upper-left corner of the client area of the specified windowed mode window.static GLFWWindowPosCallback
glfwSetWindowPosCallback(long window, GLFWWindowPosCallbackI cbfun)
Sets the position callback of the specified window, which is called when the window is moved.static GLFWWindowRefreshCallback
glfwSetWindowRefreshCallback(long window, GLFWWindowRefreshCallbackI cbfun)
Sets the refresh callback of the specified window, which is called when the client area of the window needs to be redrawn, for example if the window has been exposed after having been covered by another window.static void
glfwSetWindowShouldClose(long window, boolean value)
Sets the value of the close flag of the specified window.static void
glfwSetWindowSize(long window, int width, int height)
Sets the size, in pixels, of the client area of the specified window.static GLFWWindowSizeCallback
glfwSetWindowSizeCallback(long window, GLFWWindowSizeCallbackI cbfun)
Sets the size callback of the specified window, which is called when the window is resized.static void
glfwSetWindowSizeLimits(long window, int minwidth, int minheight, int maxwidth, int maxheight)
Sets the size limits of the client area of the specified window.static void
glfwSetWindowTitle(long window, java.nio.ByteBuffer title)
Sets the window title, encoded as UTF-8, of the specified window.static void
glfwSetWindowTitle(long window, java.lang.CharSequence title)
Sets the window title, encoded as UTF-8, of the specified window.static void
glfwSetWindowUserPointer(long window, long pointer)
Sets the user-defined pointer of the specified window.static void
glfwShowWindow(long window)
Makes the specified window visible if it was previously hidden.static void
glfwSwapBuffers(long window)
Swaps the front and back buffers of the specified window when rendering with OpenGL or OpenGL ES.static void
glfwSwapInterval(int interval)
Sets the swap interval for the current OpenGL or OpenGL ES context, i.e.static void
glfwTerminate()
Destroys all remaining windows and cursors, restores any modified gamma ramps and frees any other allocated resources.static void
glfwWaitEvents()
Waits until events are queued and processes them.static void
glfwWaitEventsTimeout(double timeout)
Waits with timeout until events are queued and processes them.static void
glfwWindowHint(int hint, int value)
Sets hints for the next call toCreateWindow
.static boolean
glfwWindowShouldClose(long window)
Returns the value of the close flag of the specified window.
-
-
-
Field Detail
-
GLFW_VERSION_MAJOR
public static final int GLFW_VERSION_MAJOR
The major version number of the GLFW library. This is incremented when the API is changed in non-compatible ways.- See Also:
- Constant Field Values
-
GLFW_VERSION_MINOR
public static final int GLFW_VERSION_MINOR
The minor version number of the GLFW library. This is incremented when features are added to the API but it remains backward-compatible.- See Also:
- Constant Field Values
-
GLFW_VERSION_REVISION
public static final int GLFW_VERSION_REVISION
The revision number of the GLFW library. This is incremented when a bug fix release is made that does not contain any API changes.- See Also:
- Constant Field Values
-
GLFW_TRUE
public static final int GLFW_TRUE
Boolean values.- See Also:
- Constant Field Values
-
GLFW_FALSE
public static final int GLFW_FALSE
Boolean values.- See Also:
- Constant Field Values
-
GLFW_RELEASE
public static final int GLFW_RELEASE
The key or button was released.- See Also:
- Constant Field Values
-
GLFW_PRESS
public static final int GLFW_PRESS
The key or button was pressed.- See Also:
- Constant Field Values
-
GLFW_REPEAT
public static final int GLFW_REPEAT
The key was held down until it repeated.- See Also:
- Constant Field Values
-
GLFW_KEY_UNKNOWN
public static final int GLFW_KEY_UNKNOWN
The unknown key.- See Also:
- Constant Field Values
-
GLFW_KEY_SPACE
public static final int GLFW_KEY_SPACE
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_APOSTROPHE
public static final int GLFW_KEY_APOSTROPHE
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_COMMA
public static final int GLFW_KEY_COMMA
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_MINUS
public static final int GLFW_KEY_MINUS
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_PERIOD
public static final int GLFW_KEY_PERIOD
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_SLASH
public static final int GLFW_KEY_SLASH
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_0
public static final int GLFW_KEY_0
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_1
public static final int GLFW_KEY_1
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_2
public static final int GLFW_KEY_2
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_3
public static final int GLFW_KEY_3
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_4
public static final int GLFW_KEY_4
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_5
public static final int GLFW_KEY_5
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_6
public static final int GLFW_KEY_6
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_7
public static final int GLFW_KEY_7
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_8
public static final int GLFW_KEY_8
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_9
public static final int GLFW_KEY_9
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_SEMICOLON
public static final int GLFW_KEY_SEMICOLON
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_EQUAL
public static final int GLFW_KEY_EQUAL
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_A
public static final int GLFW_KEY_A
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_B
public static final int GLFW_KEY_B
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_C
public static final int GLFW_KEY_C
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_D
public static final int GLFW_KEY_D
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_E
public static final int GLFW_KEY_E
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F
public static final int GLFW_KEY_F
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_G
public static final int GLFW_KEY_G
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_H
public static final int GLFW_KEY_H
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_I
public static final int GLFW_KEY_I
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_J
public static final int GLFW_KEY_J
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_K
public static final int GLFW_KEY_K
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_L
public static final int GLFW_KEY_L
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_M
public static final int GLFW_KEY_M
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_N
public static final int GLFW_KEY_N
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_O
public static final int GLFW_KEY_O
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_P
public static final int GLFW_KEY_P
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_Q
public static final int GLFW_KEY_Q
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_R
public static final int GLFW_KEY_R
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_S
public static final int GLFW_KEY_S
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_T
public static final int GLFW_KEY_T
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_U
public static final int GLFW_KEY_U
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_V
public static final int GLFW_KEY_V
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_W
public static final int GLFW_KEY_W
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_X
public static final int GLFW_KEY_X
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_Y
public static final int GLFW_KEY_Y
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_Z
public static final int GLFW_KEY_Z
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_LEFT_BRACKET
public static final int GLFW_KEY_LEFT_BRACKET
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_BACKSLASH
public static final int GLFW_KEY_BACKSLASH
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_RIGHT_BRACKET
public static final int GLFW_KEY_RIGHT_BRACKET
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_GRAVE_ACCENT
public static final int GLFW_KEY_GRAVE_ACCENT
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_WORLD_1
public static final int GLFW_KEY_WORLD_1
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_WORLD_2
public static final int GLFW_KEY_WORLD_2
Printable keys.- See Also:
- Constant Field Values
-
GLFW_KEY_ESCAPE
public static final int GLFW_KEY_ESCAPE
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_ENTER
public static final int GLFW_KEY_ENTER
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_TAB
public static final int GLFW_KEY_TAB
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_BACKSPACE
public static final int GLFW_KEY_BACKSPACE
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_INSERT
public static final int GLFW_KEY_INSERT
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_DELETE
public static final int GLFW_KEY_DELETE
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_RIGHT
public static final int GLFW_KEY_RIGHT
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_LEFT
public static final int GLFW_KEY_LEFT
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_DOWN
public static final int GLFW_KEY_DOWN
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_UP
public static final int GLFW_KEY_UP
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_PAGE_UP
public static final int GLFW_KEY_PAGE_UP
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_PAGE_DOWN
public static final int GLFW_KEY_PAGE_DOWN
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_HOME
public static final int GLFW_KEY_HOME
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_END
public static final int GLFW_KEY_END
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_CAPS_LOCK
public static final int GLFW_KEY_CAPS_LOCK
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_SCROLL_LOCK
public static final int GLFW_KEY_SCROLL_LOCK
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_NUM_LOCK
public static final int GLFW_KEY_NUM_LOCK
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_PRINT_SCREEN
public static final int GLFW_KEY_PRINT_SCREEN
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_PAUSE
public static final int GLFW_KEY_PAUSE
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F1
public static final int GLFW_KEY_F1
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F2
public static final int GLFW_KEY_F2
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F3
public static final int GLFW_KEY_F3
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F4
public static final int GLFW_KEY_F4
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F5
public static final int GLFW_KEY_F5
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F6
public static final int GLFW_KEY_F6
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F7
public static final int GLFW_KEY_F7
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F8
public static final int GLFW_KEY_F8
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F9
public static final int GLFW_KEY_F9
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F10
public static final int GLFW_KEY_F10
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F11
public static final int GLFW_KEY_F11
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F12
public static final int GLFW_KEY_F12
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F13
public static final int GLFW_KEY_F13
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F14
public static final int GLFW_KEY_F14
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F15
public static final int GLFW_KEY_F15
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F16
public static final int GLFW_KEY_F16
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F17
public static final int GLFW_KEY_F17
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F18
public static final int GLFW_KEY_F18
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F19
public static final int GLFW_KEY_F19
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F20
public static final int GLFW_KEY_F20
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F21
public static final int GLFW_KEY_F21
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F22
public static final int GLFW_KEY_F22
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F23
public static final int GLFW_KEY_F23
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F24
public static final int GLFW_KEY_F24
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_F25
public static final int GLFW_KEY_F25
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_KP_0
public static final int GLFW_KEY_KP_0
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_KP_1
public static final int GLFW_KEY_KP_1
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_KP_2
public static final int GLFW_KEY_KP_2
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_KP_3
public static final int GLFW_KEY_KP_3
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_KP_4
public static final int GLFW_KEY_KP_4
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_KP_5
public static final int GLFW_KEY_KP_5
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_KP_6
public static final int GLFW_KEY_KP_6
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_KP_7
public static final int GLFW_KEY_KP_7
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_KP_8
public static final int GLFW_KEY_KP_8
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_KP_9
public static final int GLFW_KEY_KP_9
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_KP_DECIMAL
public static final int GLFW_KEY_KP_DECIMAL
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_KP_DIVIDE
public static final int GLFW_KEY_KP_DIVIDE
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_KP_MULTIPLY
public static final int GLFW_KEY_KP_MULTIPLY
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_KP_SUBTRACT
public static final int GLFW_KEY_KP_SUBTRACT
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_KP_ADD
public static final int GLFW_KEY_KP_ADD
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_KP_ENTER
public static final int GLFW_KEY_KP_ENTER
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_KP_EQUAL
public static final int GLFW_KEY_KP_EQUAL
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_LEFT_SHIFT
public static final int GLFW_KEY_LEFT_SHIFT
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_LEFT_CONTROL
public static final int GLFW_KEY_LEFT_CONTROL
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_LEFT_ALT
public static final int GLFW_KEY_LEFT_ALT
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_LEFT_SUPER
public static final int GLFW_KEY_LEFT_SUPER
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_RIGHT_SHIFT
public static final int GLFW_KEY_RIGHT_SHIFT
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_RIGHT_CONTROL
public static final int GLFW_KEY_RIGHT_CONTROL
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_RIGHT_ALT
public static final int GLFW_KEY_RIGHT_ALT
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_RIGHT_SUPER
public static final int GLFW_KEY_RIGHT_SUPER
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_MENU
public static final int GLFW_KEY_MENU
Function keys.- See Also:
- Constant Field Values
-
GLFW_KEY_LAST
public static final int GLFW_KEY_LAST
Function keys.- See Also:
- Constant Field Values
-
GLFW_MOD_SHIFT
public static final int GLFW_MOD_SHIFT
If this bit is set one or more Shift keys were held down.- See Also:
- Constant Field Values
-
GLFW_MOD_CONTROL
public static final int GLFW_MOD_CONTROL
If this bit is set one or more Control keys were held down.- See Also:
- Constant Field Values
-
GLFW_MOD_ALT
public static final int GLFW_MOD_ALT
If this bit is set one or more Alt keys were held down.- See Also:
- Constant Field Values
-
GLFW_MOD_SUPER
public static final int GLFW_MOD_SUPER
If this bit is set one or more Super keys were held down.- See Also:
- Constant Field Values
-
GLFW_MOUSE_BUTTON_1
public static final int GLFW_MOUSE_BUTTON_1
Mouse buttons. See mouse button input for how these are used.- See Also:
- Constant Field Values
-
GLFW_MOUSE_BUTTON_2
public static final int GLFW_MOUSE_BUTTON_2
Mouse buttons. See mouse button input for how these are used.- See Also:
- Constant Field Values
-
GLFW_MOUSE_BUTTON_3
public static final int GLFW_MOUSE_BUTTON_3
Mouse buttons. See mouse button input for how these are used.- See Also:
- Constant Field Values
-
GLFW_MOUSE_BUTTON_4
public static final int GLFW_MOUSE_BUTTON_4
Mouse buttons. See mouse button input for how these are used.- See Also:
- Constant Field Values
-
GLFW_MOUSE_BUTTON_5
public static final int GLFW_MOUSE_BUTTON_5
Mouse buttons. See mouse button input for how these are used.- See Also:
- Constant Field Values
-
GLFW_MOUSE_BUTTON_6
public static final int GLFW_MOUSE_BUTTON_6
Mouse buttons. See mouse button input for how these are used.- See Also:
- Constant Field Values
-
GLFW_MOUSE_BUTTON_7
public static final int GLFW_MOUSE_BUTTON_7
Mouse buttons. See mouse button input for how these are used.- See Also:
- Constant Field Values
-
GLFW_MOUSE_BUTTON_8
public static final int GLFW_MOUSE_BUTTON_8
Mouse buttons. See mouse button input for how these are used.- See Also:
- Constant Field Values
-
GLFW_MOUSE_BUTTON_LAST
public static final int GLFW_MOUSE_BUTTON_LAST
Mouse buttons. See mouse button input for how these are used.- See Also:
- Constant Field Values
-
GLFW_MOUSE_BUTTON_LEFT
public static final int GLFW_MOUSE_BUTTON_LEFT
Mouse buttons. See mouse button input for how these are used.- See Also:
- Constant Field Values
-
GLFW_MOUSE_BUTTON_RIGHT
public static final int GLFW_MOUSE_BUTTON_RIGHT
Mouse buttons. See mouse button input for how these are used.- See Also:
- Constant Field Values
-
GLFW_MOUSE_BUTTON_MIDDLE
public static final int GLFW_MOUSE_BUTTON_MIDDLE
Mouse buttons. See mouse button input for how these are used.- See Also:
- Constant Field Values
-
GLFW_JOYSTICK_1
public static final int GLFW_JOYSTICK_1
Joysticks. See joystick input for how these are used.- See Also:
- Constant Field Values
-
GLFW_JOYSTICK_2
public static final int GLFW_JOYSTICK_2
Joysticks. See joystick input for how these are used.- See Also:
- Constant Field Values
-
GLFW_JOYSTICK_3
public static final int GLFW_JOYSTICK_3
Joysticks. See joystick input for how these are used.- See Also:
- Constant Field Values
-
GLFW_JOYSTICK_4
public static final int GLFW_JOYSTICK_4
Joysticks. See joystick input for how these are used.- See Also:
- Constant Field Values
-
GLFW_JOYSTICK_5
public static final int GLFW_JOYSTICK_5
Joysticks. See joystick input for how these are used.- See Also:
- Constant Field Values
-
GLFW_JOYSTICK_6
public static final int GLFW_JOYSTICK_6
Joysticks. See joystick input for how these are used.- See Also:
- Constant Field Values
-
GLFW_JOYSTICK_7
public static final int GLFW_JOYSTICK_7
Joysticks. See joystick input for how these are used.- See Also:
- Constant Field Values
-
GLFW_JOYSTICK_8
public static final int GLFW_JOYSTICK_8
Joysticks. See joystick input for how these are used.- See Also:
- Constant Field Values
-
GLFW_JOYSTICK_9
public static final int GLFW_JOYSTICK_9
Joysticks. See joystick input for how these are used.- See Also:
- Constant Field Values
-
GLFW_JOYSTICK_10
public static final int GLFW_JOYSTICK_10
Joysticks. See joystick input for how these are used.- See Also:
- Constant Field Values
-
GLFW_JOYSTICK_11
public static final int GLFW_JOYSTICK_11
Joysticks. See joystick input for how these are used.- See Also:
- Constant Field Values
-
GLFW_JOYSTICK_12
public static final int GLFW_JOYSTICK_12
Joysticks. See joystick input for how these are used.- See Also:
- Constant Field Values
-
GLFW_JOYSTICK_13
public static final int GLFW_JOYSTICK_13
Joysticks. See joystick input for how these are used.- See Also:
- Constant Field Values
-
GLFW_JOYSTICK_14
public static final int GLFW_JOYSTICK_14
Joysticks. See joystick input for how these are used.- See Also:
- Constant Field Values
-
GLFW_JOYSTICK_15
public static final int GLFW_JOYSTICK_15
Joysticks. See joystick input for how these are used.- See Also:
- Constant Field Values
-
GLFW_JOYSTICK_16
public static final int GLFW_JOYSTICK_16
Joysticks. See joystick input for how these are used.- See Also:
- Constant Field Values
-
GLFW_JOYSTICK_LAST
public static final int GLFW_JOYSTICK_LAST
Joysticks. See joystick input for how these are used.- See Also:
- Constant Field Values
-
GLFW_NOT_INITIALIZED
public static final int GLFW_NOT_INITIALIZED
GLFW has not been initialized.This occurs if a GLFW function was called that may not be called unless the library is initialized.
- See Also:
- Constant Field Values
-
GLFW_NO_CURRENT_CONTEXT
public static final int GLFW_NO_CURRENT_CONTEXT
No 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
SwapInterval
.- See Also:
- Constant Field Values
-
GLFW_INVALID_ENUM
public static final int GLFW_INVALID_ENUM
One of the arguments to the function was an invalid enum value.One of the arguments to the function was an invalid enum value, for example requesting
RED_BITS
withGetWindowAttrib
.- See Also:
- Constant Field Values
-
GLFW_INVALID_VALUE
public static final int GLFW_INVALID_VALUE
One of the arguments to the function was an invalid value.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.
Requesting a valid but unavailable OpenGL or OpenGL ES version will instead result in a
VERSION_UNAVAILABLE
error.- See Also:
- Constant Field Values
-
GLFW_OUT_OF_MEMORY
public static final int GLFW_OUT_OF_MEMORY
A memory allocation failed.A bug in GLFW or the underlying operating system. Report the bug to our issue tracker.
- See Also:
- Constant Field Values
-
GLFW_API_UNAVAILABLE
public static final int GLFW_API_UNAVAILABLE
GLFW could not find support for the requested API on the system.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. OS X 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:
- Constant Field Values
-
GLFW_VERSION_UNAVAILABLE
public static final int GLFW_VERSION_UNAVAILABLE
The requested OpenGL or OpenGL ES version (including any requested context or framebuffer hints) is not available on this machine.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:
- Constant Field Values
-
GLFW_PLATFORM_ERROR
public static final int GLFW_PLATFORM_ERROR
A platform-specific error occurred that does not match any of the more specific categories.A bug or configuration error in GLFW, the underlying operating system or its drivers, or a lack of required resources. Report the issue to our issue tracker.
- See Also:
- Constant Field Values
-
GLFW_FORMAT_UNAVAILABLE
public static final int GLFW_FORMAT_UNAVAILABLE
The requested format is not supported or available.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:
- Constant Field Values
-
GLFW_NO_WINDOW_CONTEXT
public static final int GLFW_NO_WINDOW_CONTEXT
The 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.
Application programmer error. Fix the offending call.
- See Also:
- Constant Field Values
-
GLFW_FOCUSED
public static final int GLFW_FOCUSED
WindowHint
: Specifies whether the windowed mode window will be given input focus when created. This hint is ignored for full screen and initially hidden windows.GetWindowAttrib
: Indicates whether the specified window has input focus.- See Also:
- Constant Field Values
-
GLFW_ICONIFIED
public static final int GLFW_ICONIFIED
GetWindowAttrib
: Indicates whether the specified window is iconified, whether by the user or withIconifyWindow
.- See Also:
- Constant Field Values
-
GLFW_RESIZABLE
public static final int GLFW_RESIZABLE
WindowHint
: Specifies whether the windowed mode window will be resizable by the user. The window will still be resizable using theSetWindowSize
function. This hint is ignored for full screen windows.GetWindowAttrib
: Indicates whether the specified window is resizable by the user.- See Also:
- Constant Field Values
-
GLFW_VISIBLE
public static final int GLFW_VISIBLE
WindowHint
: Specifies whether the windowed mode window will be initially visible. This hint is ignored for full screen windows. Windows created hidden are completely invisible to the user until shown. This can be useful if you need to set up your window further before showing it, for example moving it to a specific location.GetWindowAttrib
: Indicates whether the specified window is visible. Window visibility can be controlled withShowWindow
andHideWindow
.- See Also:
- Constant Field Values
-
GLFW_DECORATED
public static final int GLFW_DECORATED
WindowHint
: Specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc. An undecorated window may still allow the user to generate close events on some platforms. This hint is ignored for full screen windows.GetWindowAttrib
: Indicates whether the specified window has decorations such as a border, a close widget, etc.- See Also:
- Constant Field Values
-
GLFW_AUTO_ICONIFY
public static final int GLFW_AUTO_ICONIFY
WindowHint
: Specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss. This hint is ignored for windowed mode windows.- See Also:
- Constant Field Values
-
GLFW_FLOATING
public static final int GLFW_FLOATING
WindowHint
: 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. This hint is ignored for full screen windows.GetWindowAttrib
: Indicates whether the specified window is floating, also called topmost or always-on-top.- See Also:
- Constant Field Values
-
GLFW_MAXIMIZED
public static final int GLFW_MAXIMIZED
WindowHint
: Specifies whether the windowed mode window will be maximized when created. This hint is ignored for full screen windows.GetWindowAttrib
: Indicates whether the specified window is maximized, whether by the user orMaximizeWindow
.- See Also:
- Constant Field Values
-
GLFW_CURSOR
public static final int GLFW_CURSOR
Input options.- See Also:
- Constant Field Values
-
GLFW_STICKY_KEYS
public static final int GLFW_STICKY_KEYS
Input options.- See Also:
- Constant Field Values
-
GLFW_STICKY_MOUSE_BUTTONS
public static final int GLFW_STICKY_MOUSE_BUTTONS
Input options.- See Also:
- Constant Field Values
-
GLFW_CURSOR_NORMAL
public static final int GLFW_CURSOR_NORMAL
Cursor state.- See Also:
- Constant Field Values
-
GLFW_CURSOR_HIDDEN
public static final int GLFW_CURSOR_HIDDEN
Cursor state.- See Also:
- Constant Field Values
-
GLFW_CURSOR_DISABLED
public static final int GLFW_CURSOR_DISABLED
Cursor state.- See Also:
- Constant Field Values
-
GLFW_ARROW_CURSOR
public static final int GLFW_ARROW_CURSOR
Standard cursor shapes. See standard cursor creation for how these are used.- See Also:
- Constant Field Values
-
GLFW_IBEAM_CURSOR
public static final int GLFW_IBEAM_CURSOR
Standard cursor shapes. See standard cursor creation for how these are used.- See Also:
- Constant Field Values
-
GLFW_CROSSHAIR_CURSOR
public static final int GLFW_CROSSHAIR_CURSOR
Standard cursor shapes. See standard cursor creation for how these are used.- See Also:
- Constant Field Values
-
GLFW_HAND_CURSOR
public static final int GLFW_HAND_CURSOR
Standard cursor shapes. See standard cursor creation for how these are used.- See Also:
- Constant Field Values
-
GLFW_HRESIZE_CURSOR
public static final int GLFW_HRESIZE_CURSOR
Standard cursor shapes. See standard cursor creation for how these are used.- See Also:
- Constant Field Values
-
GLFW_VRESIZE_CURSOR
public static final int GLFW_VRESIZE_CURSOR
Standard cursor shapes. See standard cursor creation for how these are used.- See Also:
- Constant Field Values
-
GLFW_CONNECTED
public static final int GLFW_CONNECTED
Monitor events.- See Also:
- Constant Field Values
-
GLFW_DISCONNECTED
public static final int GLFW_DISCONNECTED
Monitor events.- See Also:
- Constant Field Values
-
GLFW_DONT_CARE
public static final int GLFW_DONT_CARE
Don't care value.- See Also:
- Constant Field Values
-
GLFW_RED_BITS
public static final int GLFW_RED_BITS
PixelFormat hints.- See Also:
- Constant Field Values
-
GLFW_GREEN_BITS
public static final int GLFW_GREEN_BITS
PixelFormat hints.- See Also:
- Constant Field Values
-
GLFW_BLUE_BITS
public static final int GLFW_BLUE_BITS
PixelFormat hints.- See Also:
- Constant Field Values
-
GLFW_ALPHA_BITS
public static final int GLFW_ALPHA_BITS
PixelFormat hints.- See Also:
- Constant Field Values
-
GLFW_DEPTH_BITS
public static final int GLFW_DEPTH_BITS
PixelFormat hints.- See Also:
- Constant Field Values
-
GLFW_STENCIL_BITS
public static final int GLFW_STENCIL_BITS
PixelFormat hints.- See Also:
- Constant Field Values
-
GLFW_ACCUM_RED_BITS
public static final int GLFW_ACCUM_RED_BITS
PixelFormat hints.- See Also:
- Constant Field Values
-
GLFW_ACCUM_GREEN_BITS
public static final int GLFW_ACCUM_GREEN_BITS
PixelFormat hints.- See Also:
- Constant Field Values
-
GLFW_ACCUM_BLUE_BITS
public static final int GLFW_ACCUM_BLUE_BITS
PixelFormat hints.- See Also:
- Constant Field Values
-
GLFW_ACCUM_ALPHA_BITS
public static final int GLFW_ACCUM_ALPHA_BITS
PixelFormat hints.- See Also:
- Constant Field Values
-
GLFW_AUX_BUFFERS
public static final int GLFW_AUX_BUFFERS
PixelFormat hints.- See Also:
- Constant Field Values
-
GLFW_STEREO
public static final int GLFW_STEREO
PixelFormat hints.- See Also:
- Constant Field Values
-
GLFW_SAMPLES
public static final int GLFW_SAMPLES
PixelFormat hints.- See Also:
- Constant Field Values
-
GLFW_SRGB_CAPABLE
public static final int GLFW_SRGB_CAPABLE
PixelFormat hints.- See Also:
- Constant Field Values
-
GLFW_REFRESH_RATE
public static final int GLFW_REFRESH_RATE
PixelFormat hints.- See Also:
- Constant Field Values
-
GLFW_DOUBLEBUFFER
public static final int GLFW_DOUBLEBUFFER
PixelFormat hints.- See Also:
- Constant Field Values
-
GLFW_CLIENT_API
public static final int GLFW_CLIENT_API
WindowHint
: Specifies which client API to create the context for. Possible values areOPENGL_API
,OPENGL_ES_API
andNO_API
. This is a hard constraint.GetWindowAttrib
: Indicates the client API provided by the window's context; eitherOPENGL_API
,OPENGL_ES_API
orNO_API
.- See Also:
- Constant Field Values
-
GLFW_CONTEXT_VERSION_MAJOR
public static final int GLFW_CONTEXT_VERSION_MAJOR
WindowHint
: Specifies the client API major version that the created context must be compatible with. The exact behavior of this hint depends on the requested client API.Notes:
- 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.
- OpenGL:
CONTEXT_VERSION_MAJOR
andCONTEXT_VERSION_MINOR
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:
CONTEXT_VERSION_MAJOR
andCONTEXT_VERSION_MINOR
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.
GetWindowAttrib
: Indicate the client API major version of the window's context.- See Also:
- Constant Field Values
-
GLFW_CONTEXT_VERSION_MINOR
public static final int GLFW_CONTEXT_VERSION_MINOR
WindowHint
: Specifies the client API minor version that the created context must be compatible with. The exact behavior of this hint depends on the requested client API.GetWindowAttrib
: Indicate the client API minor version of the window's context.- See Also:
- Constant Field Values
-
GLFW_CONTEXT_REVISION
public static final int GLFW_CONTEXT_REVISION
GetWindowAttrib
: Indicates the client API version of the window's context.- See Also:
- Constant Field Values
-
GLFW_CONTEXT_ROBUSTNESS
public static final int GLFW_CONTEXT_ROBUSTNESS
WindowHint
: 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.GetWindowAttrib
: Indicates the robustness strategy used by the context. This isLOSE_CONTEXT_ON_RESET
orNO_RESET_NOTIFICATION
if the window's context supports robustness, orNO_ROBUSTNESS
otherwise.- See Also:
- Constant Field Values
-
GLFW_OPENGL_FORWARD_COMPAT
public static final int GLFW_OPENGL_FORWARD_COMPAT
WindowHint
: 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.GetWindowAttrib
: Indicates if the window's context is an OpenGL forward-compatible one.- See Also:
- Constant Field Values
-
GLFW_OPENGL_DEBUG_CONTEXT
public static final int GLFW_OPENGL_DEBUG_CONTEXT
WindowHint
: Specifies whether to create a debug OpenGL context, which may have additional error and performance issue reporting functionality. If OpenGL ES is requested, this hint is ignored.GetWindowAttrib
: Indicates if the window's context is an OpenGL debug context.- See Also:
- Constant Field Values
-
GLFW_OPENGL_PROFILE
public static final int GLFW_OPENGL_PROFILE
WindowHint
: 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.GetWindowAttrib
: Indicates the OpenGL profile used by the context. This isOPENGL_CORE_PROFILE
orOPENGL_COMPAT_PROFILE
if the context uses a known profile, orOPENGL_ANY_PROFILE
if the OpenGL profile is unknown or the context is an OpenGL ES context. Note that the returned profile may not match the profile bits of the context flags, as GLFW will try other means of detecting the profile when no bits are set.- See Also:
- Constant Field Values
-
GLFW_CONTEXT_RELEASE_BEHAVIOR
public static final int GLFW_CONTEXT_RELEASE_BEHAVIOR
WindowHint
: Specifies the release behavior to be used by the context. 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.- See Also:
- Constant Field Values
-
GLFW_CONTEXT_NO_ERROR
public static final int GLFW_CONTEXT_NO_ERROR
WindowHint
: Specifies whether errors should be generated by the context. If enabled, situations that would have generated errors instead cause undefined behavior.- See Also:
- Constant Field Values
-
GLFW_CONTEXT_CREATION_API
public static final int GLFW_CONTEXT_CREATION_API
WindowHint
: Specifies which context creation API to use to create the context. Possible values areNATIVE_CONTEXT_API
andEGL_CONTEXT_API
. This is a hard constraint. If no client API is requested, this hint is ignored.Notes:
- Mac OS X: The EGL API is not available on this platform and requests to use it will fail.
- Wayland, Mir: The EGL API is the native context creation API, so this hint will have no effect.
- An OpenGL extension loader library that assumes it knows which context creation API is used on a given platform may fail if you change this
hint. This can be resolved by having it load via
GetProcAddress
, which always uses the selected API.
GetWindowAttrib
: Indicates the context creation API used to create the window's context; eitherNATIVE_CONTEXT_API
orEGL_CONTEXT_API
.- See Also:
- Constant Field Values
-
GLFW_NO_API
public static final int GLFW_NO_API
Values for theCLIENT_API
hint.- See Also:
- Constant Field Values
-
GLFW_OPENGL_API
public static final int GLFW_OPENGL_API
Values for theCLIENT_API
hint.- See Also:
- Constant Field Values
-
GLFW_OPENGL_ES_API
public static final int GLFW_OPENGL_ES_API
Values for theCLIENT_API
hint.- See Also:
- Constant Field Values
-
GLFW_NO_ROBUSTNESS
public static final int GLFW_NO_ROBUSTNESS
Values for theCONTEXT_ROBUSTNESS
hint.- See Also:
- Constant Field Values
-
GLFW_NO_RESET_NOTIFICATION
public static final int GLFW_NO_RESET_NOTIFICATION
Values for theCONTEXT_ROBUSTNESS
hint.- See Also:
- Constant Field Values
-
GLFW_LOSE_CONTEXT_ON_RESET
public static final int GLFW_LOSE_CONTEXT_ON_RESET
Values for theCONTEXT_ROBUSTNESS
hint.- See Also:
- Constant Field Values
-
GLFW_OPENGL_ANY_PROFILE
public static final int GLFW_OPENGL_ANY_PROFILE
Values for theOPENGL_PROFILE
hint.- See Also:
- Constant Field Values
-
GLFW_OPENGL_CORE_PROFILE
public static final int GLFW_OPENGL_CORE_PROFILE
Values for theOPENGL_PROFILE
hint.- See Also:
- Constant Field Values
-
GLFW_OPENGL_COMPAT_PROFILE
public static final int GLFW_OPENGL_COMPAT_PROFILE
Values for theOPENGL_PROFILE
hint.- See Also:
- Constant Field Values
-
GLFW_ANY_RELEASE_BEHAVIOR
public static final int GLFW_ANY_RELEASE_BEHAVIOR
Values for theCONTEXT_RELEASE_BEHAVIOR
hint.- See Also:
- Constant Field Values
-
GLFW_RELEASE_BEHAVIOR_FLUSH
public static final int GLFW_RELEASE_BEHAVIOR_FLUSH
Values for theCONTEXT_RELEASE_BEHAVIOR
hint.- See Also:
- Constant Field Values
-
GLFW_RELEASE_BEHAVIOR_NONE
public static final int GLFW_RELEASE_BEHAVIOR_NONE
Values for theCONTEXT_RELEASE_BEHAVIOR
hint.- See Also:
- Constant Field Values
-
GLFW_NATIVE_CONTEXT_API
public static final int GLFW_NATIVE_CONTEXT_API
Values for theCONTEXT_CREATION_API
hint.- See Also:
- Constant Field Values
-
GLFW_EGL_CONTEXT_API
public static final int GLFW_EGL_CONTEXT_API
Values for theCONTEXT_CREATION_API
hint.- See Also:
- Constant Field Values
-
-
Method Detail
-
getLibrary
public static SharedLibrary getLibrary()
Returns the glfwSharedLibrary
.
-
glfwInit
public static boolean glfwInit()
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.Notes:
- This function must only be called from the main thread.
- Mac OS X: This function will change the current directory of the application to the `Contents/Resources` subdirectory of the application's bundle, if present.
-
glfwTerminate
public static void glfwTerminate()
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 callInit
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.Notes:
- This function may be called before
Init
. - This function must only be called from the main thread.
- This function must not be called from a callback.
- No window's context may be current on another thread when this function is called.
- This function may be called before
-
glfwGetVersion
public static void glfwGetVersion(java.nio.IntBuffer major, java.nio.IntBuffer minor, java.nio.IntBuffer rev)
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.Notes:
- Any or all of the version arguments may be
NULL
. - This function always succeeds.
- This function may be called before
Init
. - This function may be called from any thread.
- 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
- Since:
- version 1.0
- Any or all of the version arguments may be
-
glfwGetVersionString
public static java.lang.String glfwGetVersionString()
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 withglGetString
.Do not use the version string to parse the GLFW library version. The
GetVersion
function already provides the version of the library binary in numerical format.Notes:
- This function always succeeds.
- This function may be called before
Init
. - This function may be called from any thread.
- The returned string is static and compile-time generated.
- Returns:
- the ASCII encoded GLFW version string
- Since:
- version 3.0
-
glfwSetErrorCallback
public static GLFWErrorCallback glfwSetErrorCallback(GLFWErrorCallbackI cbfun)
Sets the error callback, which is called with an error code and a human-readable description each time a GLFW error occurs.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.
Notes:
- This function may be called before
Init
. - This function must only be called from the main thread.
- Parameters:
cbfun
- the new callback orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set - Since:
- version 3.0
- This function may be called before
-
glfwGetMonitors
public static PointerBuffer glfwGetMonitors()
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 returnsNULL
.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.
This function must only be called from the main thread.
- Returns:
- an array of monitor handlers, or
NULL
if no monitors were found or if an error occured - Since:
- version 3.0
-
glfwGetPrimaryMonitor
public static long glfwGetPrimaryMonitor()
Returns the primary monitor. This is usually the monitor where elements like the task bar or global menu bar are located.This function must only be called from the main thread.
The primary monitor is always first in the array returned by
GetMonitors
.- Returns:
- the primary monitor, or
NULL
if no monitors were found or if an error occured - Since:
- version 3.0
-
glfwGetMonitorPos
public static void glfwGetMonitorPos(long monitor, java.nio.IntBuffer xpos, java.nio.IntBuffer ypos)
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
. If an error occurs, all non-NULL
position arguments will be set to zero.This function must only be called from the main thread.
- Parameters:
monitor
- the monitor to queryxpos
- where to store the monitor x-coordinate, orNULL
ypos
- where to store the monitor y-coordinate, orNULL
- Since:
- version 3.0
-
glfwGetMonitorPhysicalSize
public static void glfwGetMonitorPhysicalSize(long monitor, java.nio.IntBuffer widthMM, java.nio.IntBuffer heightMM)
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
. If an error occurs, all non-NULL
size arguments will be set to zero.Notes:
- This function must only be called from the main thread.
- Windows: The OS calculates the returned physical size from the current resolution and system DPI instead of querying the monitor EDID data.
- Parameters:
monitor
- the monitor to querywidthMM
- 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
- Since:
- version 3.0
-
glfwGetMonitorName
public static java.lang.String glfwGetMonitorName(long monitor)
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.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.
This function must only be called from the main thread.
- Parameters:
monitor
- the monitor to query- Returns:
- the UTF-8 encoded name of the monitor, or
NULL
if an error occured - Since:
- version 3.0
-
glfwSetMonitorCallback
public static GLFWMonitorCallback glfwSetMonitorCallback(GLFWMonitorCallbackI cbfun)
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.This function must only be called from the main thread.
- Parameters:
cbfun
- the new callback, orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set or the library had not been initialized - Since:
- version 3.0
-
glfwGetVideoModes
public static GLFWVidMode.Buffer glfwGetVideoModes(long monitor)
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) and then by resolution area (the product of width and height).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.
This function must only be called from the main thread.
- Parameters:
monitor
- the monitor to query- Returns:
- an array of video modes, or
NULL
if an error occured - Since:
- version 1.0
-
glfwGetVideoMode
public static GLFWVidMode glfwGetVideoMode(long monitor)
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.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.
This function must only be called from the main thread.
- Parameters:
monitor
- the monitor to query- Returns:
- the current mode of the monitor, or
NULL
if an error occurred - Since:
- version 3.0
-
glfwSetGamma
public static void glfwSetGamma(long monitor, float gamma)
Generates a 256-element gamma ramp from the specified exponent and then callsSetGammaRamp
with it. The value must be a finite number greater than zero.This function must only be called from the main thread.
- Parameters:
monitor
- the monitor whose gamma ramp to setgamma
- the desired exponent- Since:
- version 3.0
-
glfwGetGammaRamp
public static GLFWGammaRamp glfwGetGammaRamp(long monitor)
Returns the current gamma ramp of the specified monitor.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.
This function must only be called from the main thread.
- Parameters:
monitor
- the monitor to query- Returns:
- the current gamma ramp, or
NULL
if an error occurred - Since:
- version 3.0
-
glfwSetGammaRamp
public static void glfwSetGammaRamp(long monitor, GLFWGammaRamp ramp)
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 byTerminate
.Notes:
- This function must only be called from the main thread.
- Gamma ramp sizes other than 256 are not supported by all hardware
- Windows: The gamma ramp size must be 256.
- The specified gamma ramp is copied before this function returns.
- Parameters:
monitor
- the monitor whose gamma ramp to setramp
- the gamma ramp to use- Since:
- version 3.0
-
glfwDefaultWindowHints
public static void glfwDefaultWindowHints()
Resets all window hints to their default values. SeeWindowHint
for details.This function must only be called from the main thread.
-
glfwWindowHint
public static void glfwWindowHint(int hint, int value)
Sets hints for the next call toCreateWindow
. The hints, once set, retain their values until changed by a call to glfwWindowHint orDefaultWindowHints
, or until the library is terminated.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
.Supported and default values
This function must only be called from the main thread.
- Parameters:
hint
- the window hint to set. One of:value
- the new value of the window hint- Since:
- version 2.2
-
glfwCreateWindow
public static long glfwCreateWindow(int width, int height, java.nio.ByteBuffer title, long monitor, long share)
Creates a window and its associated OpenGL or OpenGL ES context. Most of the options controlling how the window and its context should be created are specified with window hints.Successful creation does not change which context is current. Before you can use the newly created context, you need to make it current. For information about the
share
parameter, see context sharing.The created window, framebuffer and context may differ from what you requested, as not all parameters and hints are hard constraints. This includes the size of the window, especially for full screen windows. To query the actual attributes of the created window, framebuffer and context, use queries like
GetWindowAttrib
andGetWindowSize
andGetFramebufferSize
.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 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 full screen.
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.
Notes:
- This function must only be called from the main thread.
- This function must not be called from a callback.
- 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_WINLOGO
icon will be used instead. To set a different icon, seeSetWindowIcon
. - Windows: The context to share resources with may not be current on any other thread.
- OS X: 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. Also, the first time a window is opened the menu bar is populated with common commands like Hide, Quit and About. The (minimal) about dialog uses information from the application's bundle. For more information on bundles, see the Bundle Programming Guide in the Mac Developer Library.
- OS X: The first time a window is created the menu bar is populated with common commands like Hide, Quit and About. The About entry opens a minimal about dialog with information from the application's bundle. The menu bar can be disabled with a compile-time option.
- OS X: On OS X 10.10 and later the window frame will not be rendered at full resolution on Retina displays unless the
NSHighResolutionCapable
key is enabled in the application bundle'sInfo.plist
. For more information, see High Resolution Guidelines for OS X in the Mac Developer Library. - X11: There is no mechanism for setting the window icon yet.
- 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.
- Parameters:
width
- the desired width, in screen coordinates, of the windowheight
- the desired height, in screen coordinates, of the windowtitle
- initial, UTF-8 encoded window titlemonitor
- the monitor to use for fullscreen mode, orNULL
for windowed modeshare
- the window whose context to share resources with, orNULL
to not share resources- Returns:
- the handle of the created window, or
NULL
if an error occurred - Since:
- version 1.0
-
glfwCreateWindow
public static long glfwCreateWindow(int width, int height, java.lang.CharSequence title, long monitor, long share)
Creates a window and its associated OpenGL or OpenGL ES context. Most of the options controlling how the window and its context should be created are specified with window hints.Successful creation does not change which context is current. Before you can use the newly created context, you need to make it current. For information about the
share
parameter, see context sharing.The created window, framebuffer and context may differ from what you requested, as not all parameters and hints are hard constraints. This includes the size of the window, especially for full screen windows. To query the actual attributes of the created window, framebuffer and context, use queries like
GetWindowAttrib
andGetWindowSize
andGetFramebufferSize
.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 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 full screen.
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.
Notes:
- This function must only be called from the main thread.
- This function must not be called from a callback.
- 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_WINLOGO
icon will be used instead. To set a different icon, seeSetWindowIcon
. - Windows: The context to share resources with may not be current on any other thread.
- OS X: 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. Also, the first time a window is opened the menu bar is populated with common commands like Hide, Quit and About. The (minimal) about dialog uses information from the application's bundle. For more information on bundles, see the Bundle Programming Guide in the Mac Developer Library.
- OS X: The first time a window is created the menu bar is populated with common commands like Hide, Quit and About. The About entry opens a minimal about dialog with information from the application's bundle. The menu bar can be disabled with a compile-time option.
- OS X: On OS X 10.10 and later the window frame will not be rendered at full resolution on Retina displays unless the
NSHighResolutionCapable
key is enabled in the application bundle'sInfo.plist
. For more information, see High Resolution Guidelines for OS X in the Mac Developer Library. - X11: There is no mechanism for setting the window icon yet.
- 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.
- Parameters:
width
- the desired width, in screen coordinates, of the windowheight
- the desired height, in screen coordinates, of the windowtitle
- initial, UTF-8 encoded window titlemonitor
- the monitor to use for fullscreen mode, orNULL
for windowed modeshare
- the window whose context to share resources with, orNULL
to not share resources- Returns:
- the handle of the created window, or
NULL
if an error occurred - Since:
- version 1.0
-
glfwDestroyWindow
public static void glfwDestroyWindow(long window)
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.
Notes:
- This function must only be called from the main thread.
- This function must not be called from a callback.
- The context of the specified window must not be current on any other thread when this function is called.
- Parameters:
window
- the window to destroy- Since:
- version 1.0
-
glfwWindowShouldClose
public static boolean glfwWindowShouldClose(long window)
Returns the value of the close flag of the specified window.This function may be called from any thread.
- Parameters:
window
- the window to query- Returns:
- the value of the close flag
- Since:
- version 3.0
-
glfwSetWindowShouldClose
public static void glfwSetWindowShouldClose(long window, boolean value)
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.This function may be called from any thread. Access is not synchronized.
- Parameters:
window
- the window whose flag to changevalue
- the new value- Since:
- version 3.0
-
glfwSetWindowTitle
public static void glfwSetWindowTitle(long window, java.nio.ByteBuffer title)
Sets the window title, encoded as UTF-8, of the specified window.This function must only be called from the main thread.
OS X: The window title will not be updated until the next time you process events.
- Parameters:
window
- the window whose title to changetitle
- the UTF-8 encoded window title- Since:
- version 1.0
-
glfwSetWindowTitle
public static void glfwSetWindowTitle(long window, java.lang.CharSequence title)
Sets the window title, encoded as UTF-8, of the specified window.This function must only be called from the main thread.
OS X: The window title will not be updated until the next time you process events.
- Parameters:
window
- the window whose title to changetitle
- the UTF-8 encoded window title- Since:
- version 1.0
-
glfwSetWindowIcon
public static void glfwSetWindowIcon(long window, GLFWImage.Buffer 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 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.
The specified image data is copied before this function returns.
OS X: 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.
This function must only be called from the main thread.
- Parameters:
window
- the window whose icon to setimages
- the images to create the icon from. This is ignored if count is zero.- Since:
- version 3.2
-
glfwGetWindowPos
public static void glfwGetWindowPos(long window, java.nio.IntBuffer xpos, java.nio.IntBuffer ypos)
Retrieves the position, in screen coordinates, of the upper-left corner of the client area of the specified window.Any or all of the position arguments may be
NULL
. If an error occurs, all non-NULL
position arguments will be set to zero.This function must only be called from the main thread.
- Parameters:
window
- the window to queryxpos
- where to store the x-coordinate of the upper-left corner of the client area, orNULL
ypos
- where to store the y-coordinate of the upper-left corner of the client area, orNULL
- Since:
- version 3.0
-
glfwSetWindowPos
public static void glfwSetWindowPos(long window, int xpos, int ypos)
Sets the position, in screen coordinates, of the upper-left corner of the client 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.
This function must only be called from the main thread.
- Parameters:
window
- the window to queryxpos
- the x-coordinate of the upper-left corner of the client areaypos
- the y-coordinate of the upper-left corner of the client area- Since:
- version 1.0
-
glfwGetWindowSize
public static void glfwGetWindowSize(long window, java.nio.IntBuffer width, java.nio.IntBuffer height)
Retrieves the size, in screen coordinates, of the client area of the specified window. If you wish to retrieve the size of the framebuffer of the window in pixels, seeGetFramebufferSize
.Any or all of the size arguments may be
NULL
. If an error occurs, all non-NULL
size arguments will be set to zero.This function must only be called from the main thread.
- Parameters:
window
- the window whose size to retrievewidth
- where to store the width, in screen coordinates, of the client area, orNULL
height
- where to store the height, in screen coordinates, of the client area, orNULL
- Since:
- version 1.0
-
glfwSetWindowSizeLimits
public static void glfwSetWindowSizeLimits(long window, int minwidth, int minheight, int maxwidth, int maxheight)
Sets the size limits of the client area of the specified window. If the window is full screen, the size limits only take effect if 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.
This function must only be called from the main thread.
- Parameters:
window
- the window to set limits forminwidth
- the minimum width, in screen coordinates, of the client area, orDONT_CARE
minheight
- the minimum height, in screen coordinates, of the client area, orDONT_CARE
maxwidth
- the maximum width, in screen coordinates, of the client area, orDONT_CARE
maxheight
- the maximum height, in screen coordinates, of the client area, orDONT_CARE
- Since:
- version 3.2
-
glfwSetWindowAspectRatio
public static void glfwSetWindowAspectRatio(long window, int numer, int denom)
Sets the required aspect ratio of the client 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.
This function must only be called from the main thread.
-
glfwSetWindowSize
public static void glfwSetWindowSize(long window, int width, int height)
Sets the size, in pixels, of the client 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
.The window manager may put limits on what sizes are allowed. GLFW cannot and should not override these limits.
This function must only be called from the main thread.
- Parameters:
window
- the window to resizewidth
- the desired width, in screen coordinates, of the window client areaheight
- the desired height, in screen coordinates, of the window client area- Since:
- version 1.0
-
glfwGetFramebufferSize
public static void glfwGetFramebufferSize(long window, java.nio.IntBuffer width, java.nio.IntBuffer height)
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, seeGetWindowSize
.Any or all of the size arguments may be
NULL
. If an error occurs, all non-NULL
size arguments will be set to zero.This function must only be called from the main thread.
- Parameters:
window
- the window whose framebuffer to querywidth
- where to store the width, in pixels, of the framebuffer, orNULL
height
- where to store the height, in pixels, of the framebuffer, orNULL
- Since:
- version 3.0
-
glfwGetWindowFrameSize
public static void glfwGetWindowFrameSize(long window, java.nio.IntBuffer left, java.nio.IntBuffer top, java.nio.IntBuffer right, java.nio.IntBuffer bottom)
Retrieves the size, in screen coordinates, of each edge of the frame of the specified window. This size includes the title bar, if the window has one. The size of the frame may vary depending on the window-related hints used to create it.Because this function retrieves the size of each window frame edge and not the offset along a particular coordinate axis, the retrieved values will always be zero or positive.
Any or all of the size arguments may be
NULL
. If an error occurs, all non-NULL
size arguments will be set to zero.This function must only be called from the main thread.
- Parameters:
window
- the window whose frame size to queryleft
- 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
- Since:
- version 3.1
-
glfwIconifyWindow
public static void glfwIconifyWindow(long window)
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, the original monitor resolution is restored until the window is restored.
This function must only be called from the main thread.
- Parameters:
window
- the window to iconify- Since:
- version 2.1
-
glfwRestoreWindow
public static void glfwRestoreWindow(long window)
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 a full screen window, the resolution chosen for the window is restored on the selected monitor.
This function must only be called from the main thread.
- Parameters:
window
- the window to restore- Since:
- version 2.1
-
glfwMaximizeWindow
public static void glfwMaximizeWindow(long window)
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.
This function may only be called from the main thread.
- Parameters:
window
- the window to maximize- Since:
- version 3.2
-
glfwShowWindow
public static void glfwShowWindow(long window)
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.This function must only be called from the main thread.
- Parameters:
window
- the window to make visible- Since:
- version 3.0
-
glfwHideWindow
public static void glfwHideWindow(long window)
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.This function must only be called from the main thread.
- Parameters:
window
- the window to hide- Since:
- version 3.0
-
glfwFocusWindow
public static void glfwFocusWindow(long window)
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
hint 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.
This function must only be called from the main thread.
- Parameters:
window
- the window to give input focus- Since:
- version 3.2
-
glfwGetWindowMonitor
public static long glfwGetWindowMonitor(long window)
Returns the handle of the monitor that the specified window is in full screen on.This function must only be called from the main thread.
- Parameters:
window
- the window to query- Returns:
- the monitor, or
NULL
if the window is in windowed mode or an error occurred - Since:
- version 3.0
-
glfwSetWindowMonitor
public static void glfwSetWindowMonitor(long window, long monitor, int xpos, int ypos, int width, int height, int refreshRate)
Sets the mode, monitor, video mode and placement of a window.This function sets the monitor that the window uses for full screen mode or, if the monitor is
NULL
, makes it windowed mode.When setting a monitor, this function updates the width, height and refresh rate of the desired video mode and switches to the video mode closest to it. The window position is ignored when setting a monitor.
When the monitor is
NULL
, the position, width and height are used to place the window client 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
.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.
This function must only be called from the main thread.
- Parameters:
window
- the window whose monitor, size or video mode to setmonitor
- the desired monitor, orNULL
to set windowed modexpos
- the desired x-coordinate of the upper-left corner of the client areaypos
- the desired y-coordinate of the upper-left corner of the client areawidth
- the desired with, in screen coordinates, of the client area or video modeheight
- the desired height, in screen coordinates, of the client area or video moderefreshRate
- the desired refresh rate, in Hz, of the video mode, orDONT_CARE
- Since:
- version 3.2
-
glfwGetWindowAttrib
public static int glfwGetWindowAttrib(long window, int attrib)
Returns the value of an attribute of the specified window or its OpenGL or OpenGL ES context.This function must only be called from the main thread.
Framebuffer related hints are not window attributes.
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.
- Parameters:
window
- the window to queryattrib
- the window attribute whose value to return. One of:- Returns:
- the value of the attribute, or zero if an error occured
- Since:
- version 3.0
-
glfwSetWindowUserPointer
public static void glfwSetWindowUserPointer(long window, long pointer)
Sets the user-defined pointer of the specified window. The current value is retained until the window is destroyed. The initial value isNULL
.This function may be called from any thread. Access is not synchronized.
- Parameters:
window
- the window whose pointer to setpointer
- the new value- Since:
- version 3.0
-
glfwGetWindowUserPointer
public static long glfwGetWindowUserPointer(long window)
Returns the current value of the user-defined pointer of the specified window. The initial value isNULL
.This function may be called from any thread. Access is not synchronized.
- Parameters:
window
- the window whose pointer to return- Since:
- version 3.0
-
glfwSetWindowPosCallback
public static GLFWWindowPosCallback glfwSetWindowPosCallback(long window, GLFWWindowPosCallbackI cbfun)
Sets the position callback of the specified window, which is called when the window is moved. The callback is provided with the screen position of the upper-left corner of the client area of the window.This function must only be called from the main thread.
- Parameters:
window
- the window whose callback to setcbfun
- the new callback orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set or the library had not been initialized - Since:
- version 1.0
-
glfwSetWindowSizeCallback
public static GLFWWindowSizeCallback glfwSetWindowSizeCallback(long window, GLFWWindowSizeCallbackI cbfun)
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 client area of the window.This function must only be called from the main thread.
- Parameters:
window
- the window whose callback to setcbfun
- the new callback orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set or the library had not been initialized - Since:
- version 1.0
-
glfwSetWindowCloseCallback
public static GLFWWindowCloseCallback glfwSetWindowCloseCallback(long window, GLFWWindowCloseCallbackI cbfun)
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
.The close callback is not triggered by
DestroyWindow
.Notes:
- This function must only be called from the main thread.
- Mac OS X: Selecting Quit from the application menu will trigger the close callback for all windows.
- Parameters:
window
- the window whose callback to setcbfun
- the new callback orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set or the library had not been initialized - Since:
- version 2.5
-
glfwSetWindowRefreshCallback
public static GLFWWindowRefreshCallback glfwSetWindowRefreshCallback(long window, GLFWWindowRefreshCallbackI cbfun)
Sets the refresh callback of the specified window, which is called when the client 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 or Aqua, where the window contents are saved off-screen, this callback may be called only very infrequently or never at all.
This function must only be called from the main thread.
- Parameters:
window
- the window whose callback to setcbfun
- the new callback orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set or the library had not been initialized - Since:
- version 2.5
-
glfwSetWindowFocusCallback
public static GLFWWindowFocusCallback glfwSetWindowFocusCallback(long window, GLFWWindowFocusCallbackI cbfun)
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
andSetMouseButtonCallback
.This function must only be called from the main thread.
- Parameters:
window
- the window whose callback to setcbfun
- the new callback orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set or the library had not been initialized - Since:
- version 3.0
-
glfwSetWindowIconifyCallback
public static GLFWWindowIconifyCallback glfwSetWindowIconifyCallback(long window, GLFWWindowIconifyCallbackI cbfun)
Sets the iconification callback of the specified window, which is called when the window is iconified or restored.This function must only be called from the main thread.
- Parameters:
window
- the window whose callback to setcbfun
- the new callback orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set or the library had not been initialized - Since:
- version 3.0
-
glfwSetFramebufferSizeCallback
public static GLFWFramebufferSizeCallback glfwSetFramebufferSizeCallback(long window, GLFWFramebufferSizeCallbackI cbfun)
Sets the framebuffer resize callback of the specified window, which is called when the framebuffer of the specified window is resized.This function must only be called from the main thread.
- Parameters:
window
- the window whose callback to setcbfun
- the new callback orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set or the library had not been initialized - Since:
- version 3.0
-
glfwPollEvents
public static void glfwPollEvents()
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.
On some platforms, certain events are sent directly to the application without going through the event queue, causing callbacks to be called outside of a call to one of the event processing functions.
Event processing is not required for joystick input to work.
Notes:
- This function must only be called from the main thread.
- This function must not be called from a callback.
-
glfwWaitEvents
public static void glfwWaitEvents()
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.
On some platforms, certain callbacks may be called outside of a call to one of the event processing functions.
If no windows exist, this function returns immediately. For synchronization of threads in applications that do not create windows, use your threading library of choice.
Event processing is not required for joystick input to work.
Notes:
- This function must only be called from the main thread.
- This function must not be called from a callback.
-
glfwWaitEventsTimeout
public static void glfwWaitEventsTimeout(double timeout)
Waits with timeout until events are queued and processes them.This function puts the calling thread to sleep until at least one event is available in the event queue, or until the specified timeout is reached. If one or more events are available, it behaves exactly like
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.
On some platforms, certain callbacks may be called outside of a call to one of the event processing functions.
If no windows exist, this function returns immediately. For synchronization of threads in applications that do not create windows, use your threading library of choice.
Event processing is not required for joystick input to work.
Notes:
- This function must only be called from the main thread.
- This function must not be called from a callback.
- Parameters:
timeout
- the maximum amount of time, in seconds, to wait- Since:
- version 3.2
-
glfwPostEmptyEvent
public static void glfwPostEmptyEvent()
Posts an empty event from the current thread to the main thread event queue, causingWaitEvents
to return.If no windows exist, this function returns immediately. For synchronization of threads in applications that do not create windows, use your threading library of choice.
This function may be called from any thread.
-
glfwGetInputMode
public static int glfwGetInputMode(long window, int mode)
Returns the value of an input option for the specified window.This function must only be called from the main thread.
- Parameters:
window
- the window to querymode
- the input mode whose value to return. One of:CURSOR
STICKY_KEYS
STICKY_MOUSE_BUTTONS
- Returns:
- the input mode value
- Since:
- version 3.0
-
glfwSetInputMode
public static void glfwSetInputMode(long window, int mode, int value)
Sets an input option for the specified window.If
mode
isCURSOR
, 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 client 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
mode
isSTICKY_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
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
mode
isSTICKY_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
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.This function must only be called from the main thread.
- Parameters:
window
- the window whose input mode to setmode
- the input mode to set. One of:CURSOR
STICKY_KEYS
STICKY_MOUSE_BUTTONS
value
- the new value of the specified input mode- Since:
- GFLW 3.0
-
glfwGetKeyName
public static java.lang.String glfwGetKeyName(int key, int scancode)
Returns the localized name of the specified printable key. This is intended for displaying key bindings to the user.If the key is
KEY_UNKNOWN
, the scancode is used instead, otherwise the scancode is ignored. If a non-printable key or (if the key isKEY_UNKNOWN
) a scancode that maps to a non-printable key is specified, this function returnsNULL
.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
The returned string is allocated and freed by GLFW. You should not free it yourself. It is valid until the next call to
GetKeyName
, or until the library is terminated.This function must only be called from the main thread.
- Parameters:
key
- the key to query, orKEY_UNKNOWN
scancode
- the scancode of the key to query- Returns:
- the localized name of the key, or
NULL
- Since:
- version 3.2
-
glfwGetKey
public static int glfwGetKey(long window, int key)
Returns the last state reported for the specified key to the specified window. The returned state is one ofPRESS
orRELEASE
. The higher-level 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.
Notes:
- This function must only be called from the main thread.
KEY_UNKNOWN
is not a valid key for this function.
-
glfwGetMouseButton
public static int glfwGetMouseButton(long window, int button)
Returns the last state reported for the specified mouse button to the specified window. The returned state is one ofPRESS
orRELEASE
. The higher-level actionREPEAT
is only reported to the mouse button callback.If the
STICKY_MOUSE_BUTTONS
input mode is enabled, this function returnsPRESS
the first time you call it for a mouse button that has been pressed, even if that mouse button has already been released.This function must only be called from the main thread.
-
glfwGetCursorPos
public static void glfwGetCursorPos(long window, java.nio.DoubleBuffer xpos, java.nio.DoubleBuffer ypos)
Returns the position of the cursor, in screen coordinates, relative to the upper-left corner of the client 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 a double.The coordinates can be converted to their integer equivalents with the
Math.floor(double)
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
. If an error occurs, all non-NULL
position arguments will be set to zero.This function must only be called from the main thread.
- Parameters:
window
- the desired windowxpos
- where to store the cursor x-coordinate, relative to the left edge of the client area, orNULL
ypos
- where to store the cursor y-coordinate, relative to the to top edge of the client area, orNULL
.- Since:
- version 1.0
-
glfwSetCursorPos
public static void glfwSetCursorPos(long window, double xpos, double ypos)
Sets the position, in screen coordinates, of the cursor relative to the upper-left corner of the client 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
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 double.This function must only be called from the main thread.
- Parameters:
window
- the desired windowxpos
- the desired x-coordinate, relative to the left edge of the client areaypos
- the desired y-coordinate, relative to the top edge of the client area- Since:
- version 1.0
-
glfwCreateCursor
public static long glfwCreateCursor(GLFWImage image, int xhot, int yhot)
Creates a new custom cursor image that can be set for a window withSetCursor
. The cursor can be destroyed withDestroyCursor
. Any remaining cursors are destroyed byTerminate
.The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel. 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.
Notes:
- This function must only be called from the main thread.
- This function must not be called from a callback.
- The specified image data is copied before this function returns.
- Parameters:
image
- the desired cursor imagexhot
- the desired x-coordinate, in pixels, of the cursor hotspotyhot
- the desired y-coordinate, in pixels, of the cursor hotspot- Returns:
- the handle of the created cursor, or
NULL
if an error occurred - Since:
- version 3.1
-
glfwCreateStandardCursor
public static long glfwCreateStandardCursor(int shape)
Returns a cursor with a standard shape, that can be set for a window withSetCursor
.Notes:
- This function must only be called from the main thread.
- This function must not be called from a callback.
- The specified image data is copied before this function returns.
- Parameters:
shape
- one of the standard shapes. One of:ARROW_CURSOR
IBEAM_CURSOR
CROSSHAIR_CURSOR
HAND_CURSOR
HRESIZE_CURSOR
VRESIZE_CURSOR
- Returns:
- a new cursor ready to use or
NULL
if an error occurred - Since:
- version 3.1
-
glfwDestroyCursor
public static void glfwDestroyCursor(long cursor)
Destroys a cursor previously created withCreateCursor
. Any remaining cursors will be destroyed byTerminate
.Notes:
- This function must only be called from the main thread.
- This function must not be called from a callback.
- Parameters:
cursor
- the cursor object to destroy- Since:
- version 3.1
-
glfwSetCursor
public static void glfwSetCursor(long window, long cursor)
Sets the cursor image to be used when the cursor is over the client area of the specified window. The set cursor will only be visible when the cursor mode of the window isCURSOR_NORMAL
.On some platforms, the set cursor may not be visible unless the window also has input focus.
This function must only be called from the main thread.
- Parameters:
window
- the window to set the system cursor forcursor
- the cursor to set, orNULL
to switch back to the default arrow cursor- Since:
- version 3.1
-
glfwSetKeyCallback
public static GLFWKeyCallback glfwSetKeyCallback(long window, GLFWKeyCallbackI cbfun)
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
SetCharCallback
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 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
.Sometimes GLFW needs to generate synthetic key events, in which case the scancode may be zero.
This function must only be called from the main thread.
- Parameters:
window
- the window whose callback to setcbfun
- the new callback orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set - Since:
- version 1.0
-
glfwSetCharCallback
public static GLFWCharCallback glfwSetCharCallback(long window, GLFWCharCallbackI cbfun)
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
SetKeyCallback
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 OS X or Alt key on Windows. There is
SetCharModsCallback
that receives these events.This function must only be called from the main thread.
- Parameters:
window
- the window whose callback to setcbfun
- the new callback orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set - Since:
- version 2.4
-
glfwSetCharModsCallback
public static GLFWCharModsCallback glfwSetCharModsCallback(long window, GLFWCharModsCallbackI cbfun)
Sets the character with modifiers callback of the specified window, which is called when a Unicode character is input regardless of what modifier keys are used.The character with modifiers callback is intended for implementing custom Unicode character input. For regular Unicode text input, see
SetCharCallback
. Like the character callback, the character with modifiers callback deals with characters and is keyboard layout dependent. 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, seeSetKeyCallback
instead.This function must only be called from the main thread.
- Parameters:
window
- the window whose callback to setcbfun
- the new callback orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set - Since:
- version 3.1
-
glfwSetMouseButtonCallback
public static GLFWMouseButtonCallback glfwSetMouseButtonCallback(long window, GLFWMouseButtonCallbackI cbfun)
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 has been called.
This function must only be called from the main thread.
- Parameters:
window
- the window whose callback to setcbfun
- the new callback orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set - Since:
- version 1.0
-
glfwSetCursorPosCallback
public static GLFWCursorPosCallback glfwSetCursorPosCallback(long window, GLFWCursorPosCallbackI cbfun)
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 client area of the window.This function must only be called from the main thread.
- Parameters:
window
- the window whose callback to setcbfun
- the new callback orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set - Since:
- version 1.0
-
glfwSetCursorEnterCallback
public static GLFWCursorEnterCallback glfwSetCursorEnterCallback(long window, GLFWCursorEnterCallbackI cbfun)
Sets the cursor boundary crossing callback of the specified window, which is called when the cursor enters or leaves the client area of the window.This function must only be called from the main thread.
- Parameters:
window
- the window whose callback to setcbfun
- the new callback orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set - Since:
- version 3.0
-
glfwSetScrollCallback
public static GLFWScrollCallback glfwSetScrollCallback(long window, GLFWScrollCallbackI cbfun)
Sets the scroll callback of the specified window, which is called when a scrolling device is used.The scroll callback receives all scrolling input, like that from a mouse wheel or a touchpad scrolling area.
This function must only be called from the main thread.
- Parameters:
window
- the window whose callback to setcbfun
- the new callback orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set - Since:
- version 2.1
-
glfwSetDropCallback
public static GLFWDropCallback glfwSetDropCallback(long window, GLFWDropCallbackI cbfun)
Sets the file drop callback of the specified window, which is called when one or more dragged files 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.
This function must only be called from the main thread.
- Parameters:
window
- the window whose callback to setcbfun
- the new callback orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set - Since:
- version 3.1
-
glfwJoystickPresent
public static boolean glfwJoystickPresent(int joy)
Returns whether the specified joystick is present.This function must only be called from the main thread.
-
glfwGetJoystickAxes
public static java.nio.FloatBuffer glfwGetJoystickAxes(int joy)
Returns the values of all axes of the specified joystick. Each element in the array is a value between -1.0 and 1.0.Querying a joystick slot with no device present is not an error, but will cause this function to return
NULL
. CallJoystickPresent
to check device presence.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.
This function must only be called from the main thread.
- Parameters:
joy
- the joystick to query- Returns:
- an array of axis values, or
NULL
if the joystick is not present - Since:
- version 2.2
-
glfwGetJoystickButtons
public static java.nio.ByteBuffer glfwGetJoystickButtons(int joy)
Returns the state of all buttons of the specified joystick. Each element in the array is eitherPRESS
orRELEASE
.Querying a joystick slot with no device present is not an error, but will cause this function to return
NULL
. CallJoystickPresent
to check device presence.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.
This function must only be called from the main thread.
- Parameters:
joy
- the joystick to query- Returns:
- an array of button states, or
NULL
if the joystick is not present - Since:
- version 2.2
-
glfwGetJoystickName
public static java.lang.String glfwGetJoystickName(int joy)
Returns the name, encoded as UTF-8, of the specified joystick.Querying a joystick slot with no device present is not an error, but will cause this function to return
NULL
. CallJoystickPresent
to check device presence.The returned string 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.
This function must only be called from the main thread.
- Parameters:
joy
- the joystick to query- Returns:
- the UTF-8 encoded name of the joystick, or
NULL
if the joystick is not present - Since:
- version 3.0
-
glfwSetJoystickCallback
public static GLFWJoystickCallback glfwSetJoystickCallback(GLFWJoystickCallbackI cbfun)
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.
This function must only be called from the main thread.
- Parameters:
cbfun
- the new callback, orNULL
to remove the currently set callback- Returns:
- the previously set callback, or
NULL
if no callback was set or the library had not been initialized - Since:
- version 3.2
-
glfwSetClipboardString
public static void glfwSetClipboardString(long window, java.nio.ByteBuffer string)
Sets the system clipboard to the specified, UTF-8 encoded string.The specified string is copied before this function returns.
This function must only be called from the main thread.
- Parameters:
window
- the window that will own the clipboard contentsstring
- a UTF-8 encoded string- Since:
- version 3.0
-
glfwSetClipboardString
public static void glfwSetClipboardString(long window, java.lang.CharSequence string)
Sets the system clipboard to the specified, UTF-8 encoded string.The specified string is copied before this function returns.
This function must only be called from the main thread.
- Parameters:
window
- the window that will own the clipboard contentsstring
- a UTF-8 encoded string- Since:
- version 3.0
-
glfwGetClipboardString
public static java.lang.String glfwGetClipboardString(long window)
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
is returned and aFORMAT_UNAVAILABLE
error is generated.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
, or until the library is terminated.Notes:
- This function must only be called from the main thread.
- The returned string is allocated and freed by GLFW. You should not free it yourself.
- The returned string is valid only until the next call to
GetClipboardString
orSetClipboardString
.
- Parameters:
window
- the window that will request the clipboard contents- Returns:
- the contents of the clipboard as a UTF-8 encoded string, or
NULL
if an error occurred - Since:
- version 3.0
-
glfwGetTime
public static double glfwGetTime()
Returns the value of the GLFW timer. Unless the timer has been set usingSetTime
, the timer measures time elapsed since GLFW was initialized.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.
This function may be called from any thread. Reading and writing of the internal timer offset is not atomic, so it needs to be externally synchronized with calls to
SetTime
.- Returns:
- the current value, in seconds, or zero if an error occurred
- Since:
- version 1.0
-
glfwSetTime
public static void glfwSetTime(double time)
Sets the value of the GLFW timer. It then continues to count up from that value. The value must be a positive finite number less than or equal to 18446744073.0, which is approximately 584.5 years.The upper limit of the timer 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.This function may be called from any thread. Reading and writing of the internal timer offset is not atomic, so it needs to be externally synchronized with calls to
GetTime
.- Parameters:
time
- the new value, in seconds- Since:
- version 2.2
-
glfwGetTimerValue
public static long glfwGetTimerValue()
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, callGetTimerFrequency
.This function may be called from any thread.
- Returns:
- the value of the timer, or zero if an error occurred
- Since:
- version 3.2
-
glfwGetTimerFrequency
public static long glfwGetTimerFrequency()
Returns the frequency, in Hz, of the raw timer.This function may be called from any thread.
- Returns:
- the frequency of the timer, in Hz, or zero if an error occurred
- Since:
- version 3.2
-
glfwMakeContextCurrent
public static void glfwMakeContextCurrent(long window)
Makes the OpenGL or OpenGL ES context of the specified window current on the calling thread. A context can only be made current on a single thread at a time and each thread can have only a single current context at a time.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 the
CONTEXT_RELEASE_BEHAVIOR
window 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.This function may be called from any thread.
- Parameters:
window
- the window whose context to make current, orNULL
to detach the current context- Since:
- version 3.0
-
glfwGetCurrentContext
public static long glfwGetCurrentContext()
Returns the window whose OpenGL or OpenGL ES context is current on the calling thread.This function may be called from any thread.
- Returns:
- the window whose context is current, or
NULL
if no window's context is current - Since:
- version 3.0
-
glfwSwapBuffers
public static void glfwSwapBuffers(long window)
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,
vkQueuePresentKHR
instead.EGL: The context of the specified window must be current on the calling thread.
This function may be called from any thread.
- Parameters:
window
- the window whose buffers to swap- Since:
- version 1.0
-
glfwSwapInterval
public static void glfwSwapInterval(int interval)
Sets the swap interval for the current OpenGL or OpenGL ES context, i.e. the number of screen updates to wait from the timeSwapBuffers
was called before swapping the buffers and returning. This is sometimes called vertical synchronization, vertical retrace synchronization or just vsync.Contexts that support either of the WGL_EXT_swap_control_tear and GLX_EXT_swap_control_tear extensions also accept negative swap intervals, which allow the driver to swap even if a frame arrives a little bit late. You can check for the presence of these extensions using
ExtensionSupported
. For more information about swap tearing, see the extension specifications.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.
Notes:
- This function may be called from any thread.
- This function is not called during window 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.
- Parameters:
interval
- the minimum number of screen updates to wait for until the buffers are swapped bySwapBuffers
- Since:
- version 1.0
-
glfwExtensionSupported
public static boolean glfwExtensionSupported(java.nio.ByteBuffer extension)
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
GetRequiredInstanceExtensions
,vkEnumerateInstanceExtensionProperties
andvkEnumerateDeviceExtensionProperties
instead.This function may be called from any thread.
-
glfwExtensionSupported
public static boolean glfwExtensionSupported(java.lang.CharSequence extension)
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
GetRequiredInstanceExtensions
,vkEnumerateInstanceExtensionProperties
andvkEnumerateDeviceExtensionProperties
instead.This function may be called from any thread.
-
glfwGetProcAddress
public static long glfwGetProcAddress(java.nio.ByteBuffer procname)
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,
GetInstanceProcAddress
,vkGetInstanceProcAddr
andvkGetDeviceProcAddr
instead.Notes:
- The address of a given function is not guaranteed to be the same between contexts.
- This function may return a non-
NULL
address despite the associated version or extension not being available. Always check the context version or extension string first. - The returned function pointer is valid until the context is destroyed or the library is terminated.
- This function may be called from any thread.
- Parameters:
procname
- the ASCII encoded name of the function- Returns:
- the address of the function, or
NULL
if an error occured - Since:
- version 1.0
-
glfwGetProcAddress
public static long glfwGetProcAddress(java.lang.CharSequence procname)
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,
GetInstanceProcAddress
,vkGetInstanceProcAddr
andvkGetDeviceProcAddr
instead.Notes:
- The address of a given function is not guaranteed to be the same between contexts.
- This function may return a non-
NULL
address despite the associated version or extension not being available. Always check the context version or extension string first. - The returned function pointer is valid until the context is destroyed or the library is terminated.
- This function may be called from any thread.
- Parameters:
procname
- the ASCII encoded name of the function- Returns:
- the address of the function, or
NULL
if an error occured - Since:
- version 1.0
-
glfwGetVersion
public static void glfwGetVersion(int[] major, int[] minor, int[] rev)
Array version of:GetVersion
-
glfwGetMonitorPos
public static void glfwGetMonitorPos(long monitor, int[] xpos, int[] ypos)
Array version of:GetMonitorPos
-
glfwGetMonitorPhysicalSize
public static void glfwGetMonitorPhysicalSize(long monitor, int[] widthMM, int[] heightMM)
Array version of:GetMonitorPhysicalSize
-
glfwGetWindowPos
public static void glfwGetWindowPos(long window, int[] xpos, int[] ypos)
Array version of:GetWindowPos
-
glfwGetWindowSize
public static void glfwGetWindowSize(long window, int[] width, int[] height)
Array version of:GetWindowSize
-
glfwGetFramebufferSize
public static void glfwGetFramebufferSize(long window, int[] width, int[] height)
Array version of:GetFramebufferSize
-
glfwGetWindowFrameSize
public static void glfwGetWindowFrameSize(long window, int[] left, int[] top, int[] right, int[] bottom)
Array version of:GetWindowFrameSize
-
glfwGetCursorPos
public static void glfwGetCursorPos(long window, double[] xpos, double[] ypos)
Array version of:GetCursorPos
-
-