public void SwapBuffers()
 {
     if (!egl.EglSwapBuffers(EGLDisplay, EGLSurface))
     {
         var error = egl.EglGetError();
         if (error == 0x300e)
         {
             throw new InvalidOperationException(string.Format("EglSwapBuffers {0:x}", error));
         }
     }
 }
        public bool Swap()
        {
            bool ret = egl.EglSwapBuffers(window.Display, window.Surface);

            if (!ret)
            {
                int err = egl.EglGetError();
                switch (err)
                {
                case EGL11.EglContextLost:
                    throw EglContextLostException.GenerateException("EglSwapBuffers", egl, err);

                case EGL11.EglBadAlloc:
                    throw EglBadAllocException.GenerateException("EglSwapBuffers", egl, err);

                default:
                    throw EglException.GenerateException("EglSwapBuffers", egl, err);
                }
            }
            return(ret);
        }