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