Program: 109279
Project: 109279
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);
  gl.glFrontFace(GL10.GL_CW);
  gl.glViewport(0,0,width,height);
  perspective();
  camera();
  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 (fbStack == null) {
    fbStack=new Stack<PFramebuffer>();
    screenFramebuffer=new PFramebuffer(parent,width,height,true);
    setFramebuffer(screenFramebuffer);
  }
  if (clear && primarySurface) {
    gl.glClearColor(0,0,0,0);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
  }
 else {
    if (fboSupported) {
      if (drawFramebuffer == null) {
        createDrawFramebuffer();
      }
      pushFramebuffer();
      setFramebuffer(drawFramebuffer);
      drawFramebuffer.addColorBuffer(drawTextures[drawIndex]);
      gl.glClearColor(0,0,0,0);
      if (clear) {
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
      }
 else {
        gl.glClear(GL10.GL_DEPTH_BUFFER_BIT);
        renderDrawTexture((drawIndex + 1) % 2);
      }
    }
 else {
      if (gl11 == null || gl11x == null) {
        throw new RuntimeException("String_Node_Str");
      }
      if (screenTexID[0] == 0) {
        createScreenTexture();
      }
      gl.glClearColor(0,0,0,0);
      gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
      drawScreenTexture();
    }
  }
  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);
  gl.glFrontFace(GL10.GL_CW);
  gl.glViewport(0,0,width,height);
  perspective();
  camera();
  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 (drawFramebuffer == null) {
          createDrawFramebuffer();
        }
      }
 else {
        if (gl11 == null || gl11x == null) {
          throw new RuntimeException("String_Node_Str");
        }
        if (screenTexID[0] == 0) {
          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 (drawFramebuffer != null) {
          pushFramebuffer();
          setFramebuffer(drawFramebuffer);
          drawFramebuffer.setColorBuffer(drawTextures[drawIndex]);
          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);
            renderDrawTexture((drawIndex + 1) % 2);
          }
        }
      }
 else {
        if (screenTexID[0] != 0) {
          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 (!fboSupported) {
      throw new RuntimeException("String_Node_Str");
    }
    if (drawFramebuffer == null) {
      createDrawFramebuffer();
    }
    pushFramebuffer();
    setFramebuffer(drawFramebuffer);
    drawFramebuffer.setColorBuffer(drawTextures[drawIndex]);
    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);
      renderDrawTexture((drawIndex + 1) % 2);
    }
  }
  clearColorBuffer0=clearColorBuffer;
  report("String_Node_Str");
}