Program: 163762
Project: 163762
Buggy source:
/** 
 * In the current implementation, start and stop are ignored (in OpenGL). This will obviously have to be revisited if/when proper depth sorting is implemented.
 */
protected void renderLines(int start,int stop){
  report("String_Node_Str");
  float sw0=0;
  gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
  for (int j=start; j < stop; j++) {
    int i=pathOffset[j];
    float sw=vertices[lines[i][VERTEX1]][SW];
    if (sw > 0) {
      gl.glLineWidth(sw);
      if (sw0 != sw && recordingModel) {
        int n0=recordedVertices.size();
        int n1=n0 + pathLength[j];
        for (int k=j + 1; k < stop; k++) {
          int i1=pathOffset[k];
          float sw1=vertices[lines[i1][VERTEX1]][SW];
          if (sw0 != sw1) {
            break;
          }
          n1=n0 + pathLength[k];
        }
        VertexGroup group=PShape3D.newVertexGroup(n0,n1,LINE_STRIP,sw,null);
        recordedGroups.add(group);
      }
      if (vertexBuffer.capacity() / 3 <= 3 * (pathLength[j] + 1)) {
        expandBuffers();
      }
      vertexBuffer.position(0);
      colorBuffer.position(0);
      int n=0;
      float a[]=vertices[lines[i][VERTEX1]];
      if (recordingModel) {
        recordedVertices.add(new PVector(a[X],a[Y],a[Z]));
        recordedColors.add(new float[]{a[SR],a[SG],a[SB],a[SA]});
        recordedNormals.add(new PVector(0,0,0));
        recordedTexCoords.add(new PVector(0,0,0));
      }
 else {
        vertexArray[3 * n + 0]=toFixed32(a[X]);
        vertexArray[3 * n + 1]=toFixed32(a[Y]);
        vertexArray[3 * n + 2]=toFixed32(a[Z]);
        colorArray[4 * n + 0]=toFixed32(a[SR]);
        colorArray[4 * n + 1]=toFixed32(a[SG]);
        colorArray[4 * n + 2]=toFixed32(a[SB]);
        colorArray[4 * n + 3]=toFixed32(a[SA]);
        n++;
      }
      for (int k=0; k < pathLength[j]; k++) {
        float b[]=vertices[lines[i][VERTEX2]];
        if (recordingModel) {
          recordedVertices.add(new PVector(b[X],b[Y],b[Z]));
          recordedColors.add(new float[]{b[SR],b[SG],b[SB],b[SA]});
          recordedNormals.add(new PVector(0,0,0));
          recordedTexCoords.add(new PVector(0,0,0));
        }
 else {
          vertexArray[3 * n + 0]=toFixed32(b[X]);
          vertexArray[3 * n + 1]=toFixed32(b[Y]);
          vertexArray[3 * n + 2]=toFixed32(b[Z]);
          colorArray[4 * n + 0]=toFixed32(b[SR]);
          colorArray[4 * n + 1]=toFixed32(b[SG]);
          colorArray[4 * n + 2]=toFixed32(b[SB]);
          colorArray[4 * n + 3]=toFixed32(b[SA]);
          n++;
        }
        i++;
      }
      if (!recordingModel) {
        vertexBuffer.put(vertexArray);
        colorBuffer.put(colorArray);
        vertexBuffer.position(0);
        colorBuffer.position(0);
        gl.glVertexPointer(3,GL10.GL_FIXED,0,vertexBuffer);
        gl.glColorPointer(4,GL10.GL_FIXED,0,colorBuffer);
        gl.glDrawArrays(GL10.GL_LINE_STRIP,0,pathLength[j] + 1);
      }
    }
    sw0=sw;
  }
  report("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * In the current implementation, start and stop are ignored (in OpenGL). This will obviously have to be revisited if/when proper depth sorting is implemented.
 */
protected void renderLines(int start,int stop){
  report("String_Node_Str");
  float sw0=0;
  gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
  for (int j=start; j < stop; j++) {
    int i=pathOffset[j];
    float sw=vertices[lines[i][VERTEX1]][SW];
    if (sw > 0) {
      gl.glLineWidth(sw);
      if (sw0 != sw && recordingModel) {
        int n0=recordedVertices.size();
        int n1=n0 + pathLength[j];
        for (int k=j + 1; k < stop; k++) {
          int i1=pathOffset[k];
          float sw1=vertices[lines[i1][VERTEX1]][SW];
          if (sw0 != sw1) {
            break;
          }
          n1=n0 + pathLength[k];
        }
        VertexGroup group=PShape3D.newVertexGroup(n0,n1,LINE_STRIP,sw,null);
        recordedGroups.add(group);
      }
      if (vertexBuffer.capacity() / 3 <= 3 * (pathLength[j] + 1)) {
        expandBuffers();
      }
      vertexBuffer.position(0);
      colorBuffer.position(0);
      int n=0;
      float a[]=vertices[lines[i][VERTEX1]];
      if (recordingModel) {
        recordedVertices.add(new PVector(a[X],a[Y],a[Z]));
        recordedColors.add(new float[]{a[SR],a[SG],a[SB],a[SA]});
        recordedNormals.add(new PVector(0,0,0));
        recordedTexCoords.add(new PVector(0,0,0));
      }
 else {
        vertexArray[3 * n + 0]=toFixed32(a[X]);
        vertexArray[3 * n + 1]=toFixed32(a[Y]);
        vertexArray[3 * n + 2]=toFixed32(a[Z]);
        colorArray[4 * n + 0]=toFixed32(a[SR]);
        colorArray[4 * n + 1]=toFixed32(a[SG]);
        colorArray[4 * n + 2]=toFixed32(a[SB]);
        colorArray[4 * n + 3]=toFixed32(a[SA]);
        n++;
      }
      for (int k=0; k < pathLength[j]; k++) {
        float b[]=vertices[lines[i][VERTEX2]];
        if (recordingModel) {
          recordedVertices.add(new PVector(b[X],b[Y],b[Z]));
          recordedColors.add(new float[]{b[SR],b[SG],b[SB],b[SA]});
          recordedNormals.add(new PVector(0,0,0));
          recordedTexCoords.add(new PVector(0,0,0));
        }
 else {
          vertexArray[3 * n + 0]=toFixed32(b[X]);
          vertexArray[3 * n + 1]=toFixed32(b[Y]);
          vertexArray[3 * n + 2]=toFixed32(b[Z]);
          colorArray[4 * n + 0]=toFixed32(b[SR]);
          colorArray[4 * n + 1]=toFixed32(b[SG]);
          colorArray[4 * n + 2]=toFixed32(b[SB]);
          colorArray[4 * n + 3]=toFixed32(b[SA]);
          n++;
        }
        i++;
      }
      if (!recordingModel) {
        vertexBuffer.put(vertexArray);
        colorBuffer.put(colorArray);
        vertexBuffer.position(0);
        colorBuffer.position(0);
        gl.glVertexPointer(3,GL10.GL_FIXED,0,vertexBuffer);
        gl.glColorPointer(4,GL10.GL_FIXED,0,colorBuffer);
        gl.glDrawArrays(GL10.GL_LINE_STRIP,0,pathLength[j] + 1);
      }
    }
    sw0=sw;
  }
  gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
  report("String_Node_Str");
}