Function plotter fixes
This commit is contained in:
parent
e00b3caeba
commit
2daa136b95
@ -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();
|
||||||
|
Loading…
Reference in New Issue
Block a user