Class Configuration<T>



  • public class Configuration<T>
    extends java.lang.Object
    This class can be used to programmatically set the LWJGL runtime configuration. It is an alternative to using system properties.

    Care must be taken when setting static options. Such options are only read once or cached in static final fields. They must be configured through this class before touching any other LWJGL class.

    • Field Detail

      • LIBRARY_PATH

        public static final Configuration<java.lang.String> LIBRARY_PATH
        Takes priority over java.library.path. It may contain one or more directory paths, separated by File.pathSeparator.

        Property: org.lwjgl.librarypath
           Usage: Dynamic

      • SHARED_LIBRARY_EXTRACT_DIRECTORY

        public static final Configuration<java.lang.String> SHARED_LIBRARY_EXTRACT_DIRECTORY
        Changes the temporary directory name created by LWJGL when extracting shared libraries from JAR files. If this option is not set, it defaults to lwjgl<user name>.

        Property: org.lwjgl.system.SharedLibraryExtractDirectory
           Usage: Dynamic

      • SHARED_LIBRARY_EXTRACT_PATH

        public static final Configuration<java.lang.String> SHARED_LIBRARY_EXTRACT_PATH
        Changes the path where LWJGL extracts shared libraries from JAR files. If this option is not set, LWJGL will try the following paths and the first successful will be used:
        • System.getProperty("java.io.tmpdir")/extractDir/version/
        • System.getProperty("user.home")/.extractDir/version/
        • .extractDir/version/
        • Files.createTempFile("lwjgl", "")
        where:
        
         extractDir = Configuration.SHARED_LIBRARY_EXTRACT_DIRECTORY
         version = Version.getVersion().replace(' ', '-')
         

        Property: org.lwjgl.system.SharedLibraryExtractPath
           Usage: Dynamic

      • EMULATE_SYSTEM_LOADLIBRARY

        public static final Configuration<java.lang.Boolean> EMULATE_SYSTEM_LOADLIBRARY
        EXPERIMENTAL: Emulates System.loadLibrary(java.lang.String) behavior in Library.loadNative(String).

        Property: org.lwjgl.system.EmulateSystemLoadLibrary
           Usage: Dynamic

      • LIBRARY_NAME

        public static final Configuration<java.lang.String> LIBRARY_NAME
        Can be used to override the LWJGL library name. It can be an absolute path.

        Property: org.lwjgl.libname
           Usage: Dynamic

      • MEMORY_ALLOCATOR

        public static final Configuration<java.lang.Object> MEMORY_ALLOCATOR
        Sets the allocator used for the MemoryUtil explicit memory management API (memAlloc/memFree/etc). Supported values:
        • jemalloc - The allocator provided by the jemalloc library
        • rpmalloc - The allocator provided by the rpmalloc library.

          LWJGL calls rpmalloc_initialize once, when the allocator is created. It never calls rpmalloc_finalize. The user is responsible for calling rpmalloc_thread_initialize and rpmalloc_thread_finalize when appropriate.

        • system - The default system memory allocator
        • <classpath> - A class that implements the MemoryAllocator interface. It will be instantiated using reflection.

        When set programmatically, it can also be a MemoryAllocator instance.

        Property: org.lwjgl.system.allocator
            Type: String or a MemoryUtil.MemoryAllocator instance
           Usage: Static

      • STACK_SIZE

        public static final Configuration<java.lang.Integer> STACK_SIZE
        Sets the stack size, in kilobytes, that will be used in the default MemoryStack constructor. This value is also used for the LWJGL-managed, thread-local, MemoryStack instances.

        If this option is not set, it defaults to 64.

        Property: org.lwjgl.system.stackSize
           Usage: Static

      • DISABLE_CHECKS

        public static final Configuration<java.lang.Boolean> DISABLE_CHECKS
        Set to true to disable LWJGL's basic checks. These are trivial checks that LWJGL performs to avoid JVM crashes, very useful during development. Their performance impact is usually minimal, but may they be disabled for release builds.

        Property: org.lwjgl.util.NoChecks
           Usage: Static

      • DEBUG

        public static final Configuration<java.lang.Boolean> DEBUG
        Set to true to enable LWJGL's debug mode. Information messages will be printed to the APIUtil.DEBUG_STREAM and extra runtime checks will be performed (some potentially expensive, performance-wise).

        Property: org.lwjgl.util.Debug
           Usage: Static

      • DEBUG_STREAM

        public static final Configuration<java.lang.Object> DEBUG_STREAM
        Can be set to override the default APIUtil.DEBUG_STREAM. It must be the name of a class that implements the Supplier<PrintStream> interface. The class will be instantiated using reflection and the result of get will become the Configuration.DEBUG_STREAM used by LWJGL.

        When set programmatically, it can also be a PrintStream instance.

        Property: org.lwjgl.util.DebugStream
            Type: String or a PrintStream instance
           Usage: Static

      • DEBUG_MEMORY_ALLOCATOR

        public static final Configuration<java.lang.Boolean> DEBUG_MEMORY_ALLOCATOR
        Set to true to enable LWJGL's debug mode for the MemoryUtil explicit memory management API (memAlloc/memFree/etc). All memory allocations through that API will be tracked and leaks will be reported on JVM exit. The memReport methods can also be used.

        When this option is enabled, a stacktrace is generated on every allocation, which may negatively impact performance. If this becomes a serious issue, the JVM option -XX:MaxJavaStackTraceDepth=d (where d >= 6) can be used to reduce the overhead.

        Property: org.lwjgl.util.DebugAllocator
           Usage: Static

      • DEBUG_STACK

        public static final Configuration<java.lang.Boolean> DEBUG_STACK
        Set to true to enable LWJGL's debug mode for the MemoryStack. When using the stack, each frame should be popped in the same method that pushed it. If this symmetry is broken, this mode will report it immediately.

        When this option is enabled, a stacktrace is generated on every push or pop to the stack, which may negatively impact performance. If this becomes a serious issue, the JVM option -XX:MaxJavaStackTraceDepth=d (where d >= 5) can be used to reduce the overhead.

        Property: org.lwjgl.util.DebugStack
           Usage: Static

      • DEBUG_FUNCTIONS

        public static final Configuration<java.lang.Boolean> DEBUG_FUNCTIONS
        When enabled, capabilities classes will print an error message when they fail to retrieve a function pointer.

        Function pointers in such classes are retrieved unconditionally, so this option may generate a lot of output and many false negatives.

        This option requires Configuration.DEBUG to be enabled.

        Property: org.lwjgl.util.DebugFunctions
           Usage: Static

      • EGL_EXPLICIT_INIT

        public static final Configuration<java.lang.Boolean> EGL_EXPLICIT_INIT
        By default, LWJGL will automatically initialize the EGL library, when it is first accessed. Set this property to disable this behavior.

        Property: org.lwjgl.egl.explicitInit
           Usage: Static

      • GLFW_CHECK_THREAD0

        public static final Configuration<java.lang.Boolean> GLFW_CHECK_THREAD0
        By default, LWJGL will check if certain GLFW functions are called on the first thread of the process and fail if that is not the case. Set this property to false to disable this behavior.

        Property: org.lwjgl.glfw.checkThread0
           Usage: Static

      • JEMALLOC_LIBRARY_NAME

        public static final Configuration<java.lang.String> JEMALLOC_LIBRARY_NAME
        Similar to Configuration.LIBRARY_NAME for the jemalloc library (org.lwjgl.system.jemalloc.libname).
      • OPENGL_MAXVERSION

        public static final Configuration<java.lang.Object> OPENGL_MAXVERSION
        Can be used to limit the maximum available OpenGL version. This can be useful to ensure that an application has not accidentally used features only available in a higher OpenGL version.

        When set programmatically, it can also be an APIUtil.APIVersion instance.

        Property: org.lwjgl.opengl.maxVersion
            Type: String (M.n) or an APIUtil.APIVersion instance
           Usage: Static

    • Method Detail

      • getProperty

        public java.lang.String getProperty()
      • set

        public void set(T value)
        Sets the option value.
        Parameters:
        value - the value to set
      • get

        public T get()
        Returns the option value.

        If the option value has not been set, null will be returned.

      • get

        public T get(T defaultValue)
        Returns the option value.

        If the option value has not been set, the specified default value will be returned.

        Parameters:
        defaultValue - the default value