Function plotter fixes

This commit is contained in:
serso 2014-09-20 14:26:55 +02:00
parent e00b3caeba
commit 2daa136b95

View File

@ -161,10 +161,14 @@ abstract class GLView extends SurfaceView implements SurfaceHolder.Callback {
if (hasSurface && !paused) {
onDrawFrame(gl);
if (!egl.eglSwapBuffers(display, surface)) {
paused = true;
}
if (egl.eglGetError() == EGL11.EGL_CONTEXT_LOST) {
paused = true;
}
if(paused) {
reinitGL();
}
if (looping) {
requestDraw();
}
@ -177,13 +181,22 @@ abstract class GLView extends SurfaceView implements SurfaceHolder.Callback {
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
this.width = width;
this.height = height;
boolean doInit = !hasSurface && !paused;
final boolean hadSurface = hasSurface;
boolean doInit = !hadSurface && !paused;
hasSurface = true;
if (doInit) {
initGL();
} else if (hadSurface) {
reinitGL();
}
}
private void reinitGL() {
deinitGL();
paused = false;
initGL();
}
public void surfaceDestroyed(SurfaceHolder holder) {
hasSurface = false;
deinitGL();