Interface GLLoadFunc

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface GLLoadFunc
GLLoadFunc relies on preview features of the Java platform:
Programs can only use GLLoadFunc when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
The OpenGL loading function.

Example

// loads OpenGL compatibility profile
if (GLLoader.load(GLFW::getProcAddress, true) == null)
    throw new IllegalStateException("Failed to load OpenGL");
Since:
0.1.0
Author:
squid233
  • Method Details

    • invoke

      MemorySegmentPREVIEW invoke(String string)
      Gets the function pointer of the given GL function.
      Parameters:
      string - the name of the function.
      Returns:
      the function pointer.
    • invoke

      @Nullable default @Nullable MethodHandle invoke(String procName, FunctionDescriptors function, Linker.OptionPREVIEW... options)
      Load a function by the given name and creates a downcall handle or null.
      Parameters:
      procName - the function name
      function - the function descriptor of the target function.
      options - the linker options associated with this linkage request.
      Returns:
      a downcall method handle, or null if the symbol is MemorySegment.NULLPREVIEW
    • trivialHandle

      default MethodHandle trivialHandle(String procName, FunctionDescriptors function)
      Load a trivial function by the given name and creates a downcall handle or null.
      Parameters:
      procName - the function name
      function - the function descriptor of the target function.
      Returns:
      a downcall method handle, or null if the symbol is MemorySegment.NULLPREVIEW