Program: 163737
Project: 163737
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(){
  VERTEXCOUNT=0;
  TRIANGLECOUNT=0;
  FACECOUNT=0;
  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();
  texCoordBuffer.rewind();
  normalBuffer.rewind();
  textureImage=null;
  textureImagePrev=null;
  blend(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.glFrontFace(GL10.GL_CW);
  gl.glViewport(0,0,width,height);
  perspective();
  camera();
  lights=false;
  lightCount=0;
  lightFalloff(1,0,0);
  lightSpecular(0,0,0);
  gl.glEnable(GL10.GL_COLOR_MATERIAL);
  gl.glEnable(GL10.GL_NORMALIZE);
  gl.glEnable(GL10.GL_RESCALE_NORMAL);
  shapeFirst=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(){
  VERTEXCOUNT=0;
  TRIANGLECOUNT=0;
  FACECOUNT=0;
  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();
  texCoordBuffer.rewind();
  normalBuffer.rewind();
  textureImage=null;
  textureImagePrev=null;
  blend(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.glFrontFace(GL10.GL_CW);
  gl.glViewport(0,0,width,height);
  camera();
  perspective();
  lights=false;
  lightCount=0;
  lightFalloff(1,0,0);
  lightSpecular(0,0,0);
  gl.glEnable(GL10.GL_COLOR_MATERIAL);
  gl.glEnable(GL10.GL_NORMALIZE);
  gl.glEnable(GL10.GL_RESCALE_NORMAL);
  shapeFirst=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");
}