/** * Request destruction of the Context. If the context is current, no context will be current after this call. * The context is destroyed when no thread has it current. */ public synchronized void destroy() throws LWJGLException { if ( destroyed ) return; destroy_requested = true; boolean was_current = isCurrent(); int error = GLES20.GL_NO_ERROR; if ( was_current ) { if ( org.lwjgl.opengles.GLContext.getCapabilities() != null && GLContext.getCapabilities().OpenGLES20 ) error = GLES20.glGetError(); try { releaseCurrent(); } catch (PowerManagementEventException e) { // Ignore } } checkDestroy(); if ( was_current && error != GLES20.GL_NO_ERROR ) throw new OpenGLException(error); }
/** Release the current context (if any). After this call, no context is current. */ public void releaseCurrent() throws LWJGLException, PowerManagementEventException { eglReleaseCurrent(drawable.getEGLDisplay()); org.lwjgl.opengles.GLContext.useContext(null); current_context_local.set(null); synchronized ( this ) { thread = null; checkDestroy(); } }
/** Make the context current */ public synchronized void makeCurrent() throws LWJGLException, PowerManagementEventException { checkAccess(); if ( destroyed ) throw new IllegalStateException("Context is destroyed"); thread = Thread.currentThread(); current_context_local.set(this); eglContext.makeCurrent(drawable.getEGLSurface()); org.lwjgl.opengles.GLContext.useContext(this); }