Class GLFWNative

java.lang.Object
overrungl.glfw.GLFWNative

public final class GLFWNative extends Object
GLFWNative relies on preview features of the Java platform:
Programs can only use GLFWNative when preview features are enabled.
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 Details

    • ngetWin32Adapter

      public static MemorySegmentPREVIEW ngetWin32Adapter(MemorySegmentPREVIEW monitor)
      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, or NULLPREVIEW 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

      public static String getWin32Adapter(MemorySegmentPREVIEW monitor)
      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, or NULLPREVIEW if an error occurred.
      See Also:
    • ngetWin32Monitor

      public static MemorySegmentPREVIEW ngetWin32Monitor(MemorySegmentPREVIEW monitor)
      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, or NULLPREVIEW 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

      public static String getWin32Monitor(MemorySegmentPREVIEW monitor)
      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, or NULLPREVIEW if an error occurred.
      See Also:
    • getWin32Window

      public static MemorySegmentPREVIEW getWin32Window(MemorySegmentPREVIEW window)
      Returns the HWND of the specified window.
      Parameters:
      window - the window.
      Returns:
      The HWND of the specified window, or NULLPREVIEW 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.
      HDC dc = GetDC(getWin32Window(window));
      This DC is private and does not need to be released.
      Thread safety:
      This function may be called from any thread. Access is not synchronized.
    • getWGLContext

      public static MemorySegmentPREVIEW getWGLContext(MemorySegmentPREVIEW window)
      Returns the HGLRC of the specified window.
      Parameters:
      window - the window.
      Returns:
      The HGLRC of the specified window, or NULLPREVIEW if an error occurred.
      Errors:
      Possible errors include GLFW.NO_WINDOW_CONTEXT and GLFW.NOT_INITIALIZED.
      Remarks:
      The HDC associated with the window can be queried with the GetDC function.
      HDC dc = GetDC(getWin32Window(window));
      This DC is private and does not need to be released.
      Thread safety:
      This function may be called from any thread. Access is not synchronized.
    • getCocoaMonitor

      public static int getCocoaMonitor(MemorySegmentPREVIEW monitor)
      Returns the CGDirectDisplayID of the specified monitor.
      Parameters:
      monitor - the monitor.
      Returns:
      The CGDirectDisplayID of the specified monitor, or kCGNullDirectDisplay 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

      public static MemorySegmentPREVIEW getCocoaWindow(MemorySegmentPREVIEW window)
      Returns the NSWindow of the specified window.
      Parameters:
      window - the window.
      Returns:
      The NSWindow of the specified window, or nil 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

      public static MemorySegmentPREVIEW getNSGLContext(MemorySegmentPREVIEW window)
      Returns the NSOpenGLContext of the specified window.
      Parameters:
      window - the window.
      Returns:
      The NSOpenGLContext of the specified window, or nil if an error occurred.
      Errors:
      Possible errors include GLFW.NO_WINDOW_CONTEXT and GLFW.NOT_INITIALIZED.
      Thread safety:
      This function may be called from any thread. Access is not synchronized.
    • getX11Display

      public static MemorySegmentPREVIEW getX11Display()
      Returns the Display used by GLFW.
      Returns:
      The Display used by GLFW, or NULLPREVIEW 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

      public static long getX11Adapter(MemorySegmentPREVIEW monitor)
      Returns the RRCrtc of the specified monitor.
      Parameters:
      monitor - the monitor.
      Returns:
      The RRCrtc of the specified monitor, or None 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

      public static long getX11Monitor(MemorySegmentPREVIEW monitor)
      Returns the RROutput of the specified monitor.
      Parameters:
      monitor - the monitor.
      Returns:
      The RROutput of the specified monitor, or None 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

      public static long getX11Window(MemorySegmentPREVIEW window)
      Returns the Window of the specified window.
      Parameters:
      window - the window.
      Returns:
      The Window of the specified window, or None 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

      public static void nsetX11SelectionString(MemorySegmentPREVIEW string)
      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 and GLFW.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

      public static void setX11SelectionString(String string)
      Sets the current primary selection to the specified string.
      Parameters:
      string - A UTF-8 encoded string.
      See Also:
    • ngetX11SelectionString

      public static MemorySegmentPREVIEW 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 a GLFW.FORMAT_UNAVAILABLE error 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_INITIALIZED and GLFW.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 or setX11SelectionStringPREVIEW, or until the library is terminated.
    • getX11SelectionString

      public static String 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

      public static MemorySegmentPREVIEW getGLXContext(MemorySegmentPREVIEW window)
      Returns the GLXContext of the specified window.
      Parameters:
      window - the window.
      Returns:
      The GLXContext of the specified window, or NULLPREVIEW if an error occurred.
      Errors:
      Possible errors include GLFW.NO_WINDOW_CONTEXT and GLFW.NOT_INITIALIZED.
      Thread safety:
      This function may be called from any thread. Access is not synchronized.
    • getGLXWindow

      public static long getGLXWindow(MemorySegmentPREVIEW window)
      Returns the GLXWindow of the specified window.
      Parameters:
      window - the window.
      Returns:
      The GLXWindow of the specified window, or None if an error occurred.
      Errors:
      Possible errors include GLFW.NO_WINDOW_CONTEXT and GLFW.NOT_INITIALIZED.
      Thread safety:
      This function may be called from any thread. Access is not synchronized.
    • getWaylandDisplay

      public static MemorySegmentPREVIEW getWaylandDisplay()
      Returns the struct wl_display* used by GLFW.
      Returns:
      The struct wl_display* used by GLFW, or NULLPREVIEW 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

      public static MemorySegmentPREVIEW getWaylandMonitor(MemorySegmentPREVIEW monitor)
      Returns the struct wl_output* of the specified monitor.
      Parameters:
      monitor - the monitor.
      Returns:
      The struct wl_output* of the specified monitor, or NULLPREVIEW 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

      public static MemorySegmentPREVIEW getWaylandWindow(MemorySegmentPREVIEW window)
      Returns the main struct wl_surface* of the specified window.
      Parameters:
      window - the window.
      Returns:
      The main struct wl_surface* of the specified window, or NULLPREVIEW 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

      public static MemorySegmentPREVIEW getEGLDisplay()
      Returns the EGLDisplay used by GLFW.
      Returns:
      The EGLDisplay used by GLFW, or EGL_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

      public static MemorySegmentPREVIEW getEGLContext(MemorySegmentPREVIEW window)
      Returns the EGLContext of the specified window.
      Parameters:
      window - the window.
      Returns:
      The EGLContext of the specified window, or EGL_NO_CONTEXT if an error occurred.
      Errors:
      Possible errors include GLFW.NO_WINDOW_CONTEXT and GLFW.NOT_INITIALIZED.
      Thread safety:
      This function may be called from any thread. Access is not synchronized.
    • getEGLSurface

      public static MemorySegmentPREVIEW getEGLSurface(MemorySegmentPREVIEW window)
      Returns the EGLSurface of the specified window.
      Parameters:
      window - the window
      Returns:
      The EGLSurface of the specified window, or EGL_NO_SURFACE if an error occurred.
      Errors:
      Possible errors include GLFW.NO_WINDOW_CONTEXT and GLFW.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, or NULLPREVIEW.
      height - height Where to store the height of the color buffer, or NULLPREVIEW.
      format - format Where to store the OSMesa pixel format of the color buffer, or NULLPREVIEW.
      buffer - buffer Where to store the address of the color buffer, or NULLPREVIEW.
      Returns:
      true if successful, or false if an error occurred.
      Errors:
      Possible errors include GLFW.NO_WINDOW_CONTEXT and GLFW.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, or null.
      height - height Where to store the height of the color buffer, or null.
      format - format Where to store the OSMesa pixel format of the color buffer, or null.
      buffer - buffer Where to store the address of the color buffer, or null.
      Returns:
      true if successful, or false 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, or NULLPREVIEW.
      height - Where to store the height of the depth buffer, or NULLPREVIEW.
      bytesPerValue - Where to store the number of bytes per depth buffer element, or NULLPREVIEW.
      buffer - Where to store the address of the depth buffer, or NULLPREVIEW.
      Returns:
      true if successful, or false if an error occurred.
      Errors:
      Possible errors include GLFW.NO_WINDOW_CONTEXT and GLFW.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, or null.
      height - Where to store the height of the depth buffer, or null.
      bytesPerValue - Where to store the number of bytes per depth buffer element, or null.
      buffer - Where to store the address of the depth buffer, or null.
      Returns:
      true if successful, or false if an error occurred.
      See Also:
    • getOSMesaContext

      public static MemorySegmentPREVIEW getOSMesaContext(MemorySegmentPREVIEW window)
      Returns the OSMesaContext of the specified window.
      Parameters:
      window - the window.
      Returns:
      The OSMesaContext of the specified window, or NULLPREVIEW if an error occurred.
      Errors:
      Possible errors include GLFW.NO_WINDOW_CONTEXT and GLFW.NOT_INITIALIZED.
      Thread safety:
      This function may be called from any thread. Access is not synchronized.