Java Code Examples for com.jme3.system.JmeSystem#isLowPermissions()

The following examples show how to use com.jme3.system.JmeSystem#isLowPermissions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProgramCache.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Creates a new program cache associated with the specified context and
 * devices.
 * The cached programs are built against the specified device and also
 * only the binaries linked to that device are stored.
 * @param context the OpenCL context
 * @param device the OpenCL device
 */
public ProgramCache(Context context, Device device) {
    this.context = context;
    this.device = device;
    if (JmeSystem.isLowPermissions()) {
        tmpFolder = null;
    } else {
        tmpFolder = JmeSystem.getStorageFolder();
    }
}
 
Example 2
Source File: LwjglAbstractDisplay.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Does LWJGL display initialization in the OpenGL thread
 */
protected void initInThread(){
    try{
        if (!JmeSystem.isLowPermissions()){
            // Enable uncaught exception handler only for current thread
            Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
                public void uncaughtException(Thread thread, Throwable thrown) {
                    listener.handleError("Uncaught exception thrown in "+thread.toString(), thrown);
                    if (needClose.get()){
                        // listener.handleError() has requested the 
                        // context to close. Satisfy request.
                        deinitInThread();
                    }
                }
            });
        }

        // For canvas, this will create a pbuffer,
        // allowing us to query information.
        // When the canvas context becomes available, it will
        // be replaced seamlessly.
        createContext(settings);
        printContextInitInfo();

        created.set(true);
    } catch (Exception ex){
        try {
            if (Display.isCreated())
                Display.destroy();
        } catch (Exception ex2){
            logger.log(Level.WARNING, null, ex2);
        }

        listener.handleError("Failed to create display", ex);
        return; // if we failed to create display, do not continue
    }
    super.internalCreate();
    listener.initialize();
}
 
Example 3
Source File: LwjglAbstractDisplay.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * Does LWJGL display initialization in the OpenGL thread
 */
protected boolean initInThread() {
    try {
        if (!JmeSystem.isLowPermissions()) {
            // Enable uncaught exception handler only for current thread
            Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
                @Override
                public void uncaughtException(Thread thread, Throwable thrown) {
                    listener.handleError("Uncaught exception thrown in "+thread.toString(), thrown);
                    if (needClose.get()) {
                        // listener.handleError() has requested the
                        // context to close. Satisfy request.
                        deinitInThread();
                    }
                }
            });
        }

        // For canvas, this will create a pbuffer,
        // allowing us to query information.
        // When the canvas context becomes available, it will
        // be replaced seamlessly.
        createContext(settings);
        printContextInitInfo();

        created.set(true);
        super.internalCreate();
    } catch (Exception ex) {
        try {
            if (Display.isCreated()) {
                Display.destroy();
            }
        } catch (Exception ex2){
            logger.log(Level.WARNING, null, ex2);
        }

        listener.handleError("Failed to create display", ex);
        createdLock.notifyAll(); // Release the lock, so start(true) doesn't deadlock.
        return false; // if we failed to create display, do not continue
    }

    listener.initialize();
    return true;
}
 
Example 4
Source File: LwjglWindowVR.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * Does LWJGL display initialization in the OpenGL thread
 */
protected boolean initInThread() {
    try {
        if (!JmeSystem.isLowPermissions()) {
            // Enable uncaught exception handler only for current thread
            Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
                @Override
                public void uncaughtException(Thread thread, Throwable thrown) {
                    listener.handleError("Uncaught exception thrown in " + thread.toString(), thrown);
                    if (needClose.get()) {
                        // listener.handleError() has requested the
                        // context to close. Satisfy request.
                        deinitInThread();
                    }
                }
            });
        }

        loadNatives();
        timer = new NanoTimer();

        // For canvas, this will create a pbuffer,
        // allowing us to query information.
        // When the canvas context becomes available, it will
        // be replaced seamlessly.
        createContext(settings);
        printContextInitInfo();

        created.set(true);
        super.internalCreate();
    } catch (Exception ex) {
        try {
            if (window != NULL) {
                glfwDestroyWindow(window);
                window = NULL;
            }
        } catch (Exception ex2) {
            LOGGER.log(Level.WARNING, null, ex2);
        }

        listener.handleError("Failed to create display", ex);
        return false; // if we failed to create display, do not continue
    }

    listener.initialize();
    return true;
}
 
Example 5
Source File: LwjglWindow.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * Does LWJGL display initialization in the OpenGL thread
 *
 * @return returns {@code true} if the context initialization was successful
 */
protected boolean initInThread() {
    try {
        if (!JmeSystem.isLowPermissions()) {
            // Enable uncaught exception handler only for current thread
            Thread.currentThread().setUncaughtExceptionHandler((thread, thrown) -> {
                listener.handleError("Uncaught exception thrown in " + thread.toString(), thrown);
                if (needClose.get()) {
                    // listener.handleError() has requested the
                    // context to close. Satisfy request.
                    deinitInThread();
                }
            });
        }

        timer = new NanoTimer();

        // For canvas, this will create a pbuffer,
        // allowing us to query information.
        // When the canvas context becomes available, it will
        // be replaced seamlessly.
        createContext(settings);
        printContextInitInfo();

        created.set(true);
        super.internalCreate();
    } catch (Exception ex) {
        try {
            if (window != NULL) {
                glfwDestroyWindow(window);
                window = NULL;
            }
        } catch (Exception ex2) {
            LOGGER.log(Level.WARNING, null, ex2);
        }

        listener.handleError("Failed to create display", ex);
        return false; // if we failed to create display, do not continue
    }

    listener.initialize();
    return true;
}