holder,null);
/*
* Before we can issue GL commands, we need to make sure the context is
* current and bound to a surface.
*/
mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext);
if(mEgl.eglGetError()==EGL11.EGL_CONTEXT_LOST)
AngleMainEngine.mDirty=true;
GL gl = mEglContext.getGL();
return gl;
}
/**
* Display the current render surface.
*
* @return false if the context has been lost.
*/
publicboolean 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;
}
publicvoid finish()
{
boolean success=true;
if(mEglSurface!=null)
{
success&=mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE,
EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
success&=mEgl.eglDestroySurface(mEglDisplay, mEglSurface);
mEglSurface =null;
}
if(mEglContext!=null)
{
success&=mEgl.eglDestroyContext(mEglDisplay, mEglContext);
mEglContext =null;
}
if(mEglDisplay!=null)
{
success&=mEgl.eglTerminate(mEglDisplay);
mEglDisplay =null;
}
AngleMainEngine.mDirty=!success;
}
EGL10 mEgl;
EGLDisplay mEglDisplay;
EGLSurface mEglSurface;
EGLConfig mEglConfig;
EGLContext mEglContext;
}