/** * Closes the EGL device if handle is not null and it's {@link EGLDisplayLifecycleCallback} is * valid. * * <p>{@inheritDoc} */ @Override public boolean close() { if (null != eglLifecycleCallback && 0 != handle) { if (DEBUG) { System.err.println( Thread.currentThread().getName() + " - EGLGraphicsDevice.close(): " + this); } eglLifecycleCallback.eglTerminate(handle); } return super.close(); }
/** * Opens the EGL device if handle is null and it's {@link EGLDisplayLifecycleCallback} is valid. * * <p>{@inheritDoc} */ @Override public boolean open() { if (null != eglLifecycleCallback && 0 == handle) { if (DEBUG) { System.err.println( Thread.currentThread().getName() + " - EGLGraphicsDevice.open(): " + this); } final int[] major = {0}; final int[] minor = {0}; handle = eglLifecycleCallback.eglGetAndInitDisplay(nativeDisplayID, major, minor); if (0 == handle) { eglVersion = VersionNumber.zeroVersion; throw new NativeWindowException("EGLGraphicsDevice.open() failed: " + this); } else { eglVersion = new VersionNumber(major[0], minor[0], 0); return true; } } return false; }