@Override public void surfaceCreated(SurfaceHolder holder) { // Log.i(logTag, "surfaceCreated"); mEglHelper.createSurface(holder); if (!mEglHelper.verifyContext()) { // Log.i(logTag, "context lost"); act.finish(); return; } }
@Override public void surfaceDestroyed(SurfaceHolder holder) { // Log.i(logTag, "surfaceDestroyed"); stopUpdate(); mEglHelper.destroySurface(); initSurface = false; }
@Override public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { /*Log.i(logTag, "surfaceChanged " + Integer.toString(w) + " " + Integer.toString(h) + " " + getHolder().getSurfaceFrame().toString());*/ if (mEglHelper.mEglContext == null) { // Log.i(logTag, "context lost"); return; } if (!initNative) { handler = new Handler(); nativeInit(w, h); queue = Looper.myQueue(); queue.addIdleHandler(this); idleHandlerActive = true; initNative = true; } else { nativeResize(w, h); postUpdate(); if (initSurface == true && android.os.Build.VERSION.SDK_INT >= 11) // HACK: resize is from a screen rotation, do swap() again or display may not // render, Android bug? Custom rotation animation in pre 3.0 redraws the screen // at least one more time anyway { // Log.i(logTag, "extra swap after rotation"); mEglHelper.swap(); } } initSurface = true; }
private static void swapBuffers() { // Log.i(logTag, "gl swap"); mEglHelper.swap(); }