public void SurfaceDestroyed(ISurfaceHolder surfaceHolder) { mLoop.Set(false); this.Interrupt(); mSurfaceView.Holder.RemoveCallback(this); //MOVED SURFACE DESTROYING CODE TO FUNCTION CALLED WHEN APP IS PAUSED INSTEAD OF UNSTABLE CATCH UPON RETURN_______ if (mEGLDisplay != null) { EGL14.EglMakeCurrent(mEGLDisplay, EGL14.EglNoSurface, EGL14.EglNoSurface, EGL14.EglNoContext); if (mEGLSurface != null) { EGL14.EglDestroySurface(mEGLDisplay, mEGLSurface); } if (mEGLSurfaceMedia != null) { EGL14.EglDestroySurface(mEGLDisplay, mEGLSurfaceMedia); } EGL14.EglDestroyContext(mEGLDisplay, mEGLContext); mSurfaceView.mHasGLContext.Set(false); EGL14.EglReleaseThread(); EGL14.EglTerminate(mEGLDisplay); mSurfaceView.mSurface.Release(); } //______________________________________________________________________________________________________________ }
public void ReleaseSurface() { if (_eglSurface != EGL14.EglNoSurface) { EGL14.EglDestroySurface(_eglDisplay, _eglSurface); _eglSurface = EGL14.EglNoSurface; } }
/** * Discards all resources held by this class, notably the EGL context. Also releases the * Surface that was passed to our constructor. */ public void release() { if (mEGLDisplay != EGL14.EglNoDisplay) { EGL14.EglMakeCurrent(mEGLDisplay, EGL14.EglNoSurface, EGL14.EglNoSurface, EGL14.EglNoContext); EGL14.EglDestroySurface(mEGLDisplay, mEGLSurface); EGL14.EglDestroyContext(mEGLDisplay, mEGLContext); EGL14.EglReleaseThread(); EGL14.EglTerminate(mEGLDisplay); } mEGLDisplay = EGL14.EglNoDisplay; mEGLContext = EGL14.EglNoContext; mEGLSurface = EGL14.EglNoSurface; mSurface.Release(); }
/** * Discard all resources held by this class, notably the EGL context. Also releases the * Surface that was passed to our constructor. */ public void Release() { if (EGL14.EglGetCurrentContext().Equals(_EGLContext)) { // Clear the current context and surface to ensure they are discarded immediately. EGL14.EglMakeCurrent(_EGLDisplay, EGL14.EglNoSurface, EGL14.EglNoSurface, EGL14.EglNoContext); } EGL14.EglDestroySurface(_EGLDisplay, _EGLSurface); EGL14.EglDestroyContext(_EGLDisplay, _EGLContext); //EGL14.eglTerminate(mEGLDisplay); _surface.Release(); // null everything out so future attempts to use this object will cause an NPE _EGLDisplay = null; _EGLContext = null; _EGLSurface = null; _surface = null; }
public void ElgShutdown() { if (eglDisplay != EGL14.EglNoDisplay) { EGL14.EglMakeCurrent(eglDisplay, EGL14.EglNoSurface, EGL14.EglNoSurface, EGL14.EglNoContext); EGL14.EglDestroySurface(eglDisplay, eglSurface); EGL14.EglDestroyContext(eglDisplay, eglContext); EGL14.EglReleaseThread(); EGL14.EglTerminate(eglDisplay); } surface.Release(); eglDisplay = EGL14.EglNoDisplay; eglContext = EGL14.EglNoContext; eglSurface = EGL14.EglNoSurface; surface = null; EGL14.EglMakeCurrent(prevEglDisplay, prevEglSurfaceDraw, prevEglSurfaceRead, prevEglContext); }
/** * Discard all resources held by this class, notably the EGL context. */ public void release() { if (mEGLDisplay != EGL14.EglNoDisplay) { EGL14.EglDestroySurface(mEGLDisplay, mEGLSurface); EGL14.EglDestroyContext(mEGLDisplay, mEGLContext); EGL14.EglReleaseThread(); EGL14.EglTerminate(mEGLDisplay); } mEGLDisplay = EGL14.EglNoDisplay; mEGLContext = EGL14.EglNoContext; mEGLSurface = EGL14.EglNoSurface; mSurface.Release(); // this causes a bunch of warnings that appear harmless but might confuse someone: // W BufferQueue: [unnamed-3997-2] cancelBuffer: BufferQueue has been abandoned! //mSurfaceTexture.release(); mTextureRender = null; mSurface = null; mSurfaceTexture = null; }