Ejemplo n.º 1
0
 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();
     }
     //______________________________________________________________________________________________________________
 }
Ejemplo n.º 2
0
 public void Release()
 {
     CheckIsNotReleased();
     ReleaseSurface();
     DetachCurrent();
     EGL14.EglDestroyContext(_eglDisplay, _eglContext);
     EGL14.EglReleaseThread();
     EGL14.EglTerminate(_eglDisplay);
     _eglContext = EGL14.EglNoContext;
     _eglDisplay = EGL14.EglNoDisplay;
     _eglConfig  = null;
 }
 /**
  * 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();
 }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
            /**
             * 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;
            }