java.lang.Object
overrungl.glfw.GLFWNative
GLFWNative relies on preview features of the Java platform:
GLFWNativerefers to one or more preview APIs:MemorySegment.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
This is the header file of the native access functions.
 
Native access
By using the native access functions you assert that you know what you're doing and how to fix problems caused by using them. If you don't, you shouldn't be using them.- Since:
 - 0.1.0
 - Author:
 - squid233
 
- 
Method Summary
Modifier and TypeMethodDescriptionstatic intgetCocoaMonitor(MemorySegmentPREVIEW monitor) Returns theCGDirectDisplayIDof the specified monitor.static MemorySegmentPREVIEWgetCocoaWindow(MemorySegmentPREVIEW window) Returns theNSWindowof the specified window.static MemorySegmentPREVIEWgetEGLContext(MemorySegmentPREVIEW window) Returns theEGLContextof the specified window.static MemorySegmentPREVIEWReturns theEGLDisplayused by GLFW.static MemorySegmentPREVIEWgetEGLSurface(MemorySegmentPREVIEW window) Returns theEGLSurfaceof the specified window.static MemorySegmentPREVIEWgetGLXContext(MemorySegmentPREVIEW window) Returns theGLXContextof the specified window.static longgetGLXWindow(MemorySegmentPREVIEW window) Returns theGLXWindowof the specified window.static MemorySegmentPREVIEWgetNSGLContext(MemorySegmentPREVIEW window) Returns theNSOpenGLContextof the specified window.static booleangetOSMesaColorBuffer(MemorySegmentPREVIEW window, int @Nullable [] width, int @Nullable [] height, int @Nullable [] format, MemorySegmentPREVIEW @Nullable [] buffer) Retrieves the color buffer associated with the specified window.static MemorySegmentPREVIEWgetOSMesaContext(MemorySegmentPREVIEW window) Returns theOSMesaContextof the specified window.static booleangetOSMesaDepthBuffer(MemorySegmentPREVIEW window, int @Nullable [] width, int @Nullable [] height, int @Nullable [] bytesPerValue, MemorySegmentPREVIEW @Nullable [] buffer) Retrieves the depth buffer associated with the specified window.static MemorySegmentPREVIEWReturns thestruct wl_display*used by GLFW.static MemorySegmentPREVIEWgetWaylandMonitor(MemorySegmentPREVIEW monitor) Returns thestruct wl_output*of the specified monitor.static MemorySegmentPREVIEWgetWaylandWindow(MemorySegmentPREVIEW window) Returns the mainstruct wl_surface*of the specified window.static MemorySegmentPREVIEWgetWGLContext(MemorySegmentPREVIEW window) Returns theHGLRCof the specified window.static StringgetWin32Adapter(MemorySegmentPREVIEW monitor) Returns the adapter device name of the specified monitor.static StringgetWin32Monitor(MemorySegmentPREVIEW monitor) Returns the display device name of the specified monitor.static MemorySegmentPREVIEWgetWin32Window(MemorySegmentPREVIEW window) Returns theHWNDof the specified window.static longgetX11Adapter(MemorySegmentPREVIEW monitor) Returns theRRCrtcof the specified monitor.static MemorySegmentPREVIEWReturns theDisplayused by GLFW.static longgetX11Monitor(MemorySegmentPREVIEW monitor) Returns theRROutputof the specified monitor.static StringReturns the contents of the current primary selection as a string.static longgetX11Window(MemorySegmentPREVIEW window) Returns theWindowof the specified window.static booleanngetOSMesaColorBuffer(MemorySegmentPREVIEW window, MemorySegmentPREVIEW width, MemorySegmentPREVIEW height, MemorySegmentPREVIEW format, MemorySegmentPREVIEW buffer) Retrieves the color buffer associated with the specified window.static booleanngetOSMesaDepthBuffer(MemorySegmentPREVIEW window, MemorySegmentPREVIEW width, MemorySegmentPREVIEW height, MemorySegmentPREVIEW bytesPerValue, MemorySegmentPREVIEW buffer) Retrieves the depth buffer associated with the specified window.static MemorySegmentPREVIEWngetWin32Adapter(MemorySegmentPREVIEW monitor) Returns the adapter device name of the specified monitor.static MemorySegmentPREVIEWngetWin32Monitor(MemorySegmentPREVIEW monitor) Returns the display device name of the specified monitor.static MemorySegmentPREVIEWReturns the contents of the current primary selection as a string.static voidSets the current primary selection to the specified string.static voidsetX11SelectionString(String string) Sets the current primary selection to the specified string. 
- 
Method Details
- 
ngetWin32Adapter
Returns the adapter device name of the specified monitor.- Parameters:
 monitor- the monitor.- Returns:
 - The UTF-8 encoded adapter device name (for example 
\\.\DISPLAY1) of the specified monitor, orNULLPREVIEW if an error occurred. - Errors:
 - Possible errors include 
GLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getWin32Adapter
Returns the adapter device name of the specified monitor. - 
ngetWin32Monitor
Returns the display device name of the specified monitor.- Parameters:
 monitor- the monitor.- Returns:
 - The UTF-8 encoded display device name (for example
 
\\.\DISPLAY1\Monitor0) of the specified monitor, orNULLPREVIEW if an error occurred. - Errors:
 - Possible errors include 
GLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getWin32Monitor
Returns the display device name of the specified monitor. - 
getWin32Window
Returns theHWNDof the specified window.- Parameters:
 window- the window.- Returns:
 - The 
HWNDof the specified window, orNULLPREVIEW if an error occurred. - Errors:
 - Possible errors include 
GLFW.NOT_INITIALIZED. - Remarks:
 - The 
HDCassociated with the window can be queried with the GetDC function.
This DC is private and does not need to be released.HDC dc = GetDC(getWin32Window(window)); - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getWGLContext
Returns theHGLRCof the specified window.- Parameters:
 window- the window.- Returns:
 - The 
HGLRCof the specified window, orNULLPREVIEW if an error occurred. - Errors:
 - Possible errors include 
GLFW.NO_WINDOW_CONTEXTandGLFW.NOT_INITIALIZED. - Remarks:
 - The 
HDCassociated with the window can be queried with the GetDC function.
This DC is private and does not need to be released.HDC dc = GetDC(getWin32Window(window)); - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getCocoaMonitor
Returns theCGDirectDisplayIDof the specified monitor.- Parameters:
 monitor- the monitor.- Returns:
 - The 
CGDirectDisplayIDof the specified monitor, orkCGNullDirectDisplayif an error occurred. - Errors:
 - Possible errors include 
GLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getCocoaWindow
Returns theNSWindowof the specified window.- Parameters:
 window- the window.- Returns:
 - The 
NSWindowof the specified window, ornilif an error occurred. - Errors:
 - Possible errors include 
GLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getNSGLContext
Returns theNSOpenGLContextof the specified window.- Parameters:
 window- the window.- Returns:
 - The 
NSOpenGLContextof the specified window, ornilif an error occurred. - Errors:
 - Possible errors include 
GLFW.NO_WINDOW_CONTEXTandGLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getX11Display
Returns theDisplayused by GLFW.- Returns:
 - The 
Displayused by GLFW, orNULLPREVIEW if an error occurred. - Errors:
 - Possible errors include 
GLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getX11Adapter
Returns theRRCrtcof the specified monitor.- Parameters:
 monitor- the monitor.- Returns:
 - The 
RRCrtcof the specified monitor, orNoneif an error occurred. - Errors:
 - Possible errors include 
GLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getX11Monitor
Returns theRROutputof the specified monitor.- Parameters:
 monitor- the monitor.- Returns:
 - The 
RROutputof the specified monitor, orNoneif an error occurred. - Errors:
 - Possible errors include 
GLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getX11Window
Returns theWindowof the specified window.- Parameters:
 window- the window.- Returns:
 - The 
Windowof the specified window, orNoneif an error occurred. - Errors:
 - Possible errors include 
GLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
nsetX11SelectionString
Sets the current primary selection to the specified string.- Parameters:
 string- string A UTF-8 encoded string.- See Also:
 - Errors:
 - Possible errors include 
GLFW.NOT_INITIALIZEDandGLFW.PLATFORM_ERROR. - Thread safety:
 - This function must only be called from the main thread.
 - Pointer lifetime:
 - The specified string is copied before this function returns.
 
 - 
setX11SelectionString
Sets the current primary selection to the specified string.- Parameters:
 string- A UTF-8 encoded string.- See Also:
 
 - 
ngetX11SelectionString
Returns the contents of the current primary selection as a string.If the selection is empty or if its contents cannot be converted,
NULLPREVIEW is returned and aGLFW.FORMAT_UNAVAILABLEerror is generated.- Returns:
 - The contents of the selection as a UTF-8 encoded string, or 
NULLPREVIEW if an error occurred. - See Also:
 - Errors:
 - Possible errors include 
GLFW.NOT_INITIALIZEDandGLFW.PLATFORM_ERROR. - Thread safety:
 - This function must only be called from the main thread.
 - Pointer lifetime:
 - The returned string is allocated and freed by GLFW. You
 should not free it yourself. It is valid until the next call to
 
ngetX11SelectionStringorsetX11SelectionStringPREVIEW, or until the library is terminated. 
 - 
getX11SelectionString
Returns the contents of the current primary selection as a string.- Returns:
 - The contents of the selection as a UTF-8 encoded string, or 
nullif an error occurred. - See Also:
 
 - 
getGLXContext
Returns theGLXContextof the specified window.- Parameters:
 window- the window.- Returns:
 - The 
GLXContextof the specified window, orNULLPREVIEW if an error occurred. - Errors:
 - Possible errors include 
GLFW.NO_WINDOW_CONTEXTandGLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getGLXWindow
Returns theGLXWindowof the specified window.- Parameters:
 window- the window.- Returns:
 - The 
GLXWindowof the specified window, orNoneif an error occurred. - Errors:
 - Possible errors include 
GLFW.NO_WINDOW_CONTEXTandGLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getWaylandDisplay
Returns thestruct wl_display*used by GLFW.- Returns:
 - The 
struct wl_display*used by GLFW, orNULLPREVIEW if an error occurred. - Errors:
 - Possible errors include 
GLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getWaylandMonitor
Returns thestruct wl_output*of the specified monitor.- Parameters:
 monitor- the monitor.- Returns:
 - The 
struct wl_output*of the specified monitor, orNULLPREVIEW if an error occurred. - Errors:
 - Possible errors include 
GLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getWaylandWindow
Returns the mainstruct wl_surface*of the specified window.- Parameters:
 window- the window.- Returns:
 - The main 
struct wl_surface*of the specified window, orNULLPREVIEW if an error occurred. - Errors:
 - Possible errors include 
GLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getEGLDisplay
Returns theEGLDisplayused by GLFW.- Returns:
 - The 
EGLDisplayused by GLFW, orEGL_NO_DISPLAYif an error occurred. - Errors:
 - Possible errors include 
GLFW.NOT_INITIALIZED. - Remarks:
 - Because EGL is initialized on demand, this function will return
 
EGL_NO_DISPLAYuntil the first context has been created via EGL. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getEGLContext
Returns theEGLContextof the specified window.- Parameters:
 window- the window.- Returns:
 - The 
EGLContextof the specified window, orEGL_NO_CONTEXTif an error occurred. - Errors:
 - Possible errors include 
GLFW.NO_WINDOW_CONTEXTandGLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getEGLSurface
Returns theEGLSurfaceof the specified window.- Parameters:
 window- the window- Returns:
 - The 
EGLSurfaceof the specified window, orEGL_NO_SURFACEif an error occurred. - Errors:
 - Possible errors include 
GLFW.NO_WINDOW_CONTEXTandGLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
ngetOSMesaColorBuffer
public static boolean ngetOSMesaColorBuffer(MemorySegmentPREVIEW window, MemorySegmentPREVIEW width, MemorySegmentPREVIEW height, MemorySegmentPREVIEW format, MemorySegmentPREVIEW buffer) Retrieves the color buffer associated with the specified window.- Parameters:
 window- window The window whose color buffer to retrieve.width- width Where to store the width of the color buffer, orNULLPREVIEW.height- height Where to store the height of the color buffer, orNULLPREVIEW.format- format Where to store the OSMesa pixel format of the color buffer, orNULLPREVIEW.buffer- buffer Where to store the address of the color buffer, orNULLPREVIEW.- Returns:
 trueif successful, orfalseif an error occurred.- Errors:
 - Possible errors include 
GLFW.NO_WINDOW_CONTEXTandGLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getOSMesaColorBuffer
public static boolean getOSMesaColorBuffer(MemorySegmentPREVIEW window, int @Nullable [] width, int @Nullable [] height, int @Nullable [] format, MemorySegmentPREVIEW @Nullable [] buffer) Retrieves the color buffer associated with the specified window.- Parameters:
 window- window The window whose color buffer to retrieve.width- width Where to store the width of the color buffer, ornull.height- height Where to store the height of the color buffer, ornull.format- format Where to store the OSMesa pixel format of the color buffer, ornull.buffer- buffer Where to store the address of the color buffer, ornull.- Returns:
 trueif successful, orfalseif an error occurred.- See Also:
 
 - 
ngetOSMesaDepthBuffer
public static boolean ngetOSMesaDepthBuffer(MemorySegmentPREVIEW window, MemorySegmentPREVIEW width, MemorySegmentPREVIEW height, MemorySegmentPREVIEW bytesPerValue, MemorySegmentPREVIEW buffer) Retrieves the depth buffer associated with the specified window.- Parameters:
 window- The window whose depth buffer to retrieve.width- Where to store the width of the depth buffer, orNULLPREVIEW.height- Where to store the height of the depth buffer, orNULLPREVIEW.bytesPerValue- Where to store the number of bytes per depth buffer element, orNULLPREVIEW.buffer- Where to store the address of the depth buffer, orNULLPREVIEW.- Returns:
 trueif successful, orfalseif an error occurred.- Errors:
 - Possible errors include 
GLFW.NO_WINDOW_CONTEXTandGLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 - 
getOSMesaDepthBuffer
public static boolean getOSMesaDepthBuffer(MemorySegmentPREVIEW window, int @Nullable [] width, int @Nullable [] height, int @Nullable [] bytesPerValue, MemorySegmentPREVIEW @Nullable [] buffer) Retrieves the depth buffer associated with the specified window.- Parameters:
 window- The window whose depth buffer to retrieve.width- Where to store the width of the depth buffer, ornull.height- Where to store the height of the depth buffer, ornull.bytesPerValue- Where to store the number of bytes per depth buffer element, ornull.buffer- Where to store the address of the depth buffer, ornull.- Returns:
 trueif successful, orfalseif an error occurred.- See Also:
 
 - 
getOSMesaContext
Returns theOSMesaContextof the specified window.- Parameters:
 window- the window.- Returns:
 - The 
OSMesaContextof the specified window, orNULLPREVIEW if an error occurred. - Errors:
 - Possible errors include 
GLFW.NO_WINDOW_CONTEXTandGLFW.NOT_INITIALIZED. - Thread safety:
 - This function may be called from any thread. Access is not synchronized.
 
 
 - 
 
GLFWNativewhen preview features are enabled.