Code example for EGL10

Methods: eglGetError, eglSwapBuffers

0
         * Display the current render surface. 
         *  
         * @return false if the context has been lost. 
         */ 
        public boolean swap() { 
            mEgl.eglSwapBuffers(mEglDisplay, mEglSurface);
 
            /* 
             * Always check for EGL_CONTEXT_LOST, which means the context and 
             * all associated data were lost (For instance because the device 
             * went to sleep). We need to sleep until we get a new surface. 
             */ 
            return mEgl.eglGetError() != EGL11.EGL_CONTEXT_LOST;
        } 
 
        public void finish() { 
            if (mEglSurface != null) {
                mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE,
                    EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
                mEgl.eglDestroySurface(mEglDisplay, mEglSurface);
                mEglSurface = null;