Program: 109217
Project: 109217
Buggy source:
/** 
 * OpenGL cannot draw until a proper native peer is available, so this returns the value of PApplet.isDisplayable() (inherited from Component).
 */
public void beginDraw(){
  if (!primarySurface) {
    PGraphicsAndroid3D a3d=(PGraphicsAndroid3D)parent.g;
    a3d.saveGLState();
    gl=a3d.gl;
    gl11=a3d.gl11;
    gl11x=a3d.gl11x;
    gl11xp=a3d.gl11xp;
    for (int i=0; i < a3d.lightCount; i++) {
      a3d.glLightDisable(i);
    }
    if (a3d.lights) {
      noLights();
    }
  }
  if (!settingsInited) {
    defaultSettings();
  }
  report("String_Node_Str");
  vertexBuffer.rewind();
  colorBuffer.rewind();
  normalBuffer.rewind();
  for (int t=0; t < numTexBuffers; t++) {
    texCoordBuffer[t].rewind();
  }
  numMultitextures=0;
  clearMultitextures();
  clearMultitextures0();
  gl.glShadeModel(GL10.GL_SMOOTH);
  blend(BLEND);
  textureBlend(BLEND);
  if (hints[DISABLE_DEPTH_TEST]) {
    gl.glDisable(GL10.GL_DEPTH_TEST);
  }
 else {
    gl.glEnable(GL10.GL_DEPTH_TEST);
  }
  gl.glDepthFunc(GL10.GL_LEQUAL);
  if (hints[DISABLE_DEPTH_MASK]) {
    gl.glDepthMask(false);
  }
 else {
    gl.glDepthMask(true);
  }
  gl.glViewport(0,0,width,height);
  camera();
  perspective();
  lights=false;
  lightCount=0;
  lightFalloff(1,0,0);
  lightSpecular(0,0,0);
  gl.glFrontFace(GL10.GL_CW);
  gl.glEnable(GL10.GL_COLOR_MATERIAL);
  gl.glEnable(GL10.GL_NORMALIZE);
  gl.glEnable(GL10.GL_RESCALE_NORMAL);
  gl.glLightModelfv(GL10.GL_LIGHT_MODEL_AMBIENT,baseLight,0);
  gl.glLightModelx(GL10.GL_LIGHT_MODEL_TWO_SIDE,0);
  shapeFirst=0;
  normalX=normalY=normalZ=0;
  if (primarySurface) {
    if (parent.frameCount == 0) {
      if (fboSupported) {
        if (offscreenFramebuffer == null) {
          createOffscreenFramebuffer();
        }
      }
 else {
        if (gl11 == null || gl11x == null) {
          throw new RuntimeException("String_Node_Str");
        }
        if (texture == null) {
          createScreenTexture();
        }
      }
    }
    if (clearColorBuffer) {
      gl.glClearColor(0,0,0,0);
      gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    }
 else {
      if (fboSupported) {
        if (offscreenFramebuffer != null) {
          pushFramebuffer();
          setFramebuffer(offscreenFramebuffer);
          offscreenFramebuffer.setColorBuffer(offscreenTextures[offscreenIndex]);
          gl.glClearColor(0,0,0,0);
          if (parent.frameCount == 0) {
            gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
          }
 else {
            gl.glClear(GL10.GL_DEPTH_BUFFER_BIT);
            drawOffscreenTexture((offscreenIndex + 1) % 2);
          }
        }
      }
 else {
        if (texture != null) {
          gl.glClearColor(0,0,0,0);
          gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
          if (0 < parent.frameCount) {
            drawScreenTexture();
          }
        }
      }
    }
  }
 else {
    if (offscreenFramebuffer == null) {
      createOffscreenFramebuffer();
    }
    pushFramebuffer();
    setFramebuffer(offscreenFramebuffer);
    offscreenFramebuffer.setColorBuffer(offscreenTextures[offscreenIndex]);
    gl.glClearColor(0,0,0,0);
    if (clearColorBuffer || parent.frameCount == 0) {
      gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    }
 else {
      gl.glClear(GL10.GL_DEPTH_BUFFER_BIT);
      drawOffscreenTexture((offscreenIndex + 1) % 2);
    }
  }
  clearColorBuffer0=clearColorBuffer;
  report("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * OpenGL cannot draw until a proper native peer is available, so this returns the value of PApplet.isDisplayable() (inherited from Component).
 */
public void beginDraw(){
  if (!primarySurface) {
    PGraphicsAndroid3D a3d=(PGraphicsAndroid3D)parent.g;
    a3d.saveGLState();
    gl=a3d.gl;
    gl11=a3d.gl11;
    gl11x=a3d.gl11x;
    gl11xp=a3d.gl11xp;
    for (int i=0; i < a3d.lightCount; i++) {
      a3d.glLightDisable(i);
    }
  }
  if (!settingsInited) {
    defaultSettings();
  }
  report("String_Node_Str");
  vertexBuffer.rewind();
  colorBuffer.rewind();
  normalBuffer.rewind();
  for (int t=0; t < numTexBuffers; t++) {
    texCoordBuffer[t].rewind();
  }
  numMultitextures=0;
  clearMultitextures();
  clearMultitextures0();
  gl.glShadeModel(GL10.GL_SMOOTH);
  blend(BLEND);
  textureBlend(BLEND);
  if (hints[DISABLE_DEPTH_TEST]) {
    gl.glDisable(GL10.GL_DEPTH_TEST);
  }
 else {
    gl.glEnable(GL10.GL_DEPTH_TEST);
  }
  gl.glDepthFunc(GL10.GL_LEQUAL);
  if (hints[DISABLE_DEPTH_MASK]) {
    gl.glDepthMask(false);
  }
 else {
    gl.glDepthMask(true);
  }
  gl.glViewport(0,0,width,height);
  camera();
  perspective();
  noLights();
  lightFalloff(1,0,0);
  lightSpecular(0,0,0);
  gl.glFrontFace(GL10.GL_CW);
  gl.glEnable(GL10.GL_COLOR_MATERIAL);
  gl.glEnable(GL10.GL_NORMALIZE);
  gl.glEnable(GL10.GL_RESCALE_NORMAL);
  gl.glLightModelfv(GL10.GL_LIGHT_MODEL_AMBIENT,baseLight,0);
  gl.glLightModelx(GL10.GL_LIGHT_MODEL_TWO_SIDE,0);
  shapeFirst=0;
  normalX=normalY=normalZ=0;
  if (primarySurface) {
    if (parent.frameCount == 0) {
      if (fboSupported) {
        if (offscreenFramebuffer == null) {
          createOffscreenFramebuffer();
        }
      }
 else {
        if (gl11 == null || gl11x == null) {
          throw new RuntimeException("String_Node_Str");
        }
        if (texture == null) {
          createScreenTexture();
        }
      }
    }
    if (clearColorBuffer) {
      gl.glClearColor(0,0,0,0);
      gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    }
 else {
      if (fboSupported) {
        if (offscreenFramebuffer != null) {
          pushFramebuffer();
          setFramebuffer(offscreenFramebuffer);
          offscreenFramebuffer.setColorBuffer(offscreenTextures[offscreenIndex]);
          gl.glClearColor(0,0,0,0);
          if (parent.frameCount == 0) {
            gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
          }
 else {
            gl.glClear(GL10.GL_DEPTH_BUFFER_BIT);
            drawOffscreenTexture((offscreenIndex + 1) % 2);
          }
        }
      }
 else {
        if (texture != null) {
          gl.glClearColor(0,0,0,0);
          gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
          if (0 < parent.frameCount) {
            drawScreenTexture();
          }
        }
      }
    }
  }
 else {
    if (offscreenFramebuffer == null) {
      createOffscreenFramebuffer();
    }
    pushFramebuffer();
    setFramebuffer(offscreenFramebuffer);
    offscreenFramebuffer.setColorBuffer(offscreenTextures[offscreenIndex]);
    gl.glClearColor(0,0,0,0);
    if (clearColorBuffer || parent.frameCount == 0) {
      gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    }
 else {
      gl.glClear(GL10.GL_DEPTH_BUFFER_BIT);
      drawOffscreenTexture((offscreenIndex + 1) % 2);
    }
  }
  clearColorBuffer0=clearColorBuffer;
  report("String_Node_Str");
}