/**
  * Discard all resources held by this class, notably the EGL context.
  */
 public void Release()
 {
     if (mEGL != null)
     {
         if (mEGL.EglGetCurrentContext().Equals(mEGLContext))
         {
             // Clear the current context and surface to ensure they are discarded immediately.
             mEGL.EglMakeCurrent(mEGLDisplay, EGL10.EglNoSurface, EGL10.EglNoSurface,
                                 EGL10.EglNoContext);
         }
         mEGL.EglDestroySurface(mEGLDisplay, mEGLSurface);
         mEGL.EglDestroyContext(mEGLDisplay, mEGLContext);
         //mEGL.eglTerminate(mEGLDisplay);
     }
     _surface.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();
     // null everything out so future attempts to use this object will cause an NPE
     mEGLDisplay     = null;
     mEGLContext     = null;
     mEGLSurface     = null;
     mEGL            = null;
     _textureRender  = null;
     _surface        = null;
     _surfaceTexture = null;
 }