java.lang.Object
overrungl.glfw.GLFWNative
GLFWNative
relies on preview features of the Java platform:
GLFWNative
refers 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 int
getCocoaMonitor
(MemorySegmentPREVIEW monitor) Returns theCGDirectDisplayID
of the specified monitor.static MemorySegmentPREVIEW
getCocoaWindow
(MemorySegmentPREVIEW window) Returns theNSWindow
of the specified window.static MemorySegmentPREVIEW
getEGLContext
(MemorySegmentPREVIEW window) Returns theEGLContext
of the specified window.static MemorySegmentPREVIEW
Returns theEGLDisplay
used by GLFW.static MemorySegmentPREVIEW
getEGLSurface
(MemorySegmentPREVIEW window) Returns theEGLSurface
of the specified window.static MemorySegmentPREVIEW
getGLXContext
(MemorySegmentPREVIEW window) Returns theGLXContext
of the specified window.static long
getGLXWindow
(MemorySegmentPREVIEW window) Returns theGLXWindow
of the specified window.static MemorySegmentPREVIEW
getNSGLContext
(MemorySegmentPREVIEW window) Returns theNSOpenGLContext
of the specified window.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.static MemorySegmentPREVIEW
getOSMesaContext
(MemorySegmentPREVIEW window) Returns theOSMesaContext
of the specified window.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.static MemorySegmentPREVIEW
Returns thestruct wl_display*
used by GLFW.static MemorySegmentPREVIEW
getWaylandMonitor
(MemorySegmentPREVIEW monitor) Returns thestruct wl_output*
of the specified monitor.static MemorySegmentPREVIEW
getWaylandWindow
(MemorySegmentPREVIEW window) Returns the mainstruct wl_surface*
of the specified window.static MemorySegmentPREVIEW
getWGLContext
(MemorySegmentPREVIEW window) Returns theHGLRC
of the specified window.static String
getWin32Adapter
(MemorySegmentPREVIEW monitor) Returns the adapter device name of the specified monitor.static String
getWin32Monitor
(MemorySegmentPREVIEW monitor) Returns the display device name of the specified monitor.static MemorySegmentPREVIEW
getWin32Window
(MemorySegmentPREVIEW window) Returns theHWND
of the specified window.static long
getX11Adapter
(MemorySegmentPREVIEW monitor) Returns theRRCrtc
of the specified monitor.static MemorySegmentPREVIEW
Returns theDisplay
used by GLFW.static long
getX11Monitor
(MemorySegmentPREVIEW monitor) Returns theRROutput
of the specified monitor.static String
Returns the contents of the current primary selection as a string.static long
getX11Window
(MemorySegmentPREVIEW window) Returns theWindow
of the specified window.static boolean
ngetOSMesaColorBuffer
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW width, MemorySegmentPREVIEW height, MemorySegmentPREVIEW format, MemorySegmentPREVIEW buffer) Retrieves the color buffer associated with the specified window.static boolean
ngetOSMesaDepthBuffer
(MemorySegmentPREVIEW window, MemorySegmentPREVIEW width, MemorySegmentPREVIEW height, MemorySegmentPREVIEW bytesPerValue, MemorySegmentPREVIEW buffer) Retrieves the depth buffer associated with the specified window.static MemorySegmentPREVIEW
ngetWin32Adapter
(MemorySegmentPREVIEW monitor) Returns the adapter device name of the specified monitor.static MemorySegmentPREVIEW
ngetWin32Monitor
(MemorySegmentPREVIEW monitor) Returns the display device name of the specified monitor.static MemorySegmentPREVIEW
Returns the contents of the current primary selection as a string.static void
Sets the current primary selection to the specified string.static void
setX11SelectionString
(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, orNULL
PREVIEW 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, orNULL
PREVIEW 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 theHWND
of the specified window.- Parameters:
window
- the window.- Returns:
- The
HWND
of the specified window, orNULL
PREVIEW if an error occurred. - Errors:
- Possible errors include
GLFW.NOT_INITIALIZED
. - Remarks:
- The
HDC
associated 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 theHGLRC
of the specified window.- Parameters:
window
- the window.- Returns:
- The
HGLRC
of the specified window, orNULL
PREVIEW if an error occurred. - Errors:
- Possible errors include
GLFW.NO_WINDOW_CONTEXT
andGLFW.NOT_INITIALIZED
. - Remarks:
- The
HDC
associated 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 theCGDirectDisplayID
of the specified monitor.- Parameters:
monitor
- the monitor.- Returns:
- The
CGDirectDisplayID
of the specified monitor, orkCGNullDirectDisplay
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.
-
getCocoaWindow
Returns theNSWindow
of the specified window.- Parameters:
window
- the window.- Returns:
- The
NSWindow
of the specified window, ornil
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.
-
getNSGLContext
Returns theNSOpenGLContext
of the specified window.- Parameters:
window
- the window.- Returns:
- The
NSOpenGLContext
of the specified window, ornil
if an error occurred. - Errors:
- Possible errors include
GLFW.NO_WINDOW_CONTEXT
andGLFW.NOT_INITIALIZED
. - Thread safety:
- This function may be called from any thread. Access is not synchronized.
-
getX11Display
Returns theDisplay
used by GLFW.- Returns:
- The
Display
used by GLFW, orNULL
PREVIEW 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 theRRCrtc
of the specified monitor.- Parameters:
monitor
- the monitor.- Returns:
- The
RRCrtc
of the specified monitor, orNone
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.
-
getX11Monitor
Returns theRROutput
of the specified monitor.- Parameters:
monitor
- the monitor.- Returns:
- The
RROutput
of the specified monitor, orNone
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.
-
getX11Window
Returns theWindow
of the specified window.- Parameters:
window
- the window.- Returns:
- The
Window
of the specified window, orNone
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.
-
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_INITIALIZED
andGLFW.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,
NULL
PREVIEW is returned and aGLFW.FORMAT_UNAVAILABLE
error is generated.- Returns:
- The contents of the selection as a UTF-8 encoded string, or
NULL
PREVIEW if an error occurred. - See Also:
- Errors:
- Possible errors include
GLFW.NOT_INITIALIZED
andGLFW.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
ngetX11SelectionString
orsetX11SelectionString
PREVIEW, 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
null
if an error occurred. - See Also:
-
getGLXContext
Returns theGLXContext
of the specified window.- Parameters:
window
- the window.- Returns:
- The
GLXContext
of the specified window, orNULL
PREVIEW if an error occurred. - Errors:
- Possible errors include
GLFW.NO_WINDOW_CONTEXT
andGLFW.NOT_INITIALIZED
. - Thread safety:
- This function may be called from any thread. Access is not synchronized.
-
getGLXWindow
Returns theGLXWindow
of the specified window.- Parameters:
window
- the window.- Returns:
- The
GLXWindow
of the specified window, orNone
if an error occurred. - Errors:
- Possible errors include
GLFW.NO_WINDOW_CONTEXT
andGLFW.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, orNULL
PREVIEW 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, orNULL
PREVIEW 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, orNULL
PREVIEW 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 theEGLDisplay
used by GLFW.- Returns:
- The
EGLDisplay
used by GLFW, orEGL_NO_DISPLAY
if an error occurred. - Errors:
- Possible errors include
GLFW.NOT_INITIALIZED
. - Remarks:
- Because EGL is initialized on demand, this function will return
EGL_NO_DISPLAY
until the first context has been created via EGL. - Thread safety:
- This function may be called from any thread. Access is not synchronized.
-
getEGLContext
Returns theEGLContext
of the specified window.- Parameters:
window
- the window.- Returns:
- The
EGLContext
of the specified window, orEGL_NO_CONTEXT
if an error occurred. - Errors:
- Possible errors include
GLFW.NO_WINDOW_CONTEXT
andGLFW.NOT_INITIALIZED
. - Thread safety:
- This function may be called from any thread. Access is not synchronized.
-
getEGLSurface
Returns theEGLSurface
of the specified window.- Parameters:
window
- the window- Returns:
- The
EGLSurface
of the specified window, orEGL_NO_SURFACE
if an error occurred. - Errors:
- Possible errors include
GLFW.NO_WINDOW_CONTEXT
andGLFW.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, orNULL
PREVIEW.height
- height Where to store the height of the color buffer, orNULL
PREVIEW.format
- format Where to store the OSMesa pixel format of the color buffer, orNULL
PREVIEW.buffer
- buffer Where to store the address of the color buffer, orNULL
PREVIEW.- Returns:
true
if successful, orfalse
if an error occurred.- Errors:
- Possible errors include
GLFW.NO_WINDOW_CONTEXT
andGLFW.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:
true
if successful, orfalse
if 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, orNULL
PREVIEW.height
- Where to store the height of the depth buffer, orNULL
PREVIEW.bytesPerValue
- Where to store the number of bytes per depth buffer element, orNULL
PREVIEW.buffer
- Where to store the address of the depth buffer, orNULL
PREVIEW.- Returns:
true
if successful, orfalse
if an error occurred.- Errors:
- Possible errors include
GLFW.NO_WINDOW_CONTEXT
andGLFW.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:
true
if successful, orfalse
if an error occurred.- See Also:
-
getOSMesaContext
Returns theOSMesaContext
of the specified window.- Parameters:
window
- the window.- Returns:
- The
OSMesaContext
of the specified window, orNULL
PREVIEW if an error occurred. - Errors:
- Possible errors include
GLFW.NO_WINDOW_CONTEXT
andGLFW.NOT_INITIALIZED
. - Thread safety:
- This function may be called from any thread. Access is not synchronized.
-
GLFWNative
when preview features are enabled.