Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public void MakeCurrent(IWindowInfo win)
        {
            if (win == null)
            {
                ClearCurrent();
                return;
            }
            var w = win as AndroidWindow;

            if (w == null)
            {
                w = window;
            }
            var surf = surface == null ? w.Surface : surface;
            var ctx  = EGLContext;

            if (win == null)
            {
                surf = EGL10.EglNoSurface;
                ctx  = EGL10.EglNoContext;
            }

            if (!egl.EglMakeCurrent(window.Display, surf, surf, ctx))
            {
                int err = egl.EglGetError();
                switch (err)
                {
                case EGL11.EglContextLost:
                    throw EglContextLostException.GenerateException("MakeCurrent", egl, err);

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

                default:
                    throw EglException.GenerateException("MakeCurrent", egl, err);
                }
            }
        }