Program: 109304
Project: 109304
Buggy source:
protected void renderTriangles(int start,int stop){
  report("String_Node_Str");
  GLTexture tex=null;
  boolean texturing=false;
  vertexBuffer.position(0);
  colorBuffer.position(0);
  normalBuffer.position(0);
  textureBuffer.position(0);
  gl.glPushMatrix();
  gl.glScalef(1,-1,1);
  gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
  gl.glEnableClientState(GL10.GL_NORMAL_ARRAY);
  for (int j=0; j < faceCount; j++) {
    int i=faceOffset[j];
    if (faceTexture[j] != null) {
      tex=faceTexture[j].getTexture();
      if (tex != null) {
        gl.glEnable(tex.getGLTarget());
        gl.glBindTexture(tex.getGLTarget(),tex.getGLTextureID());
        gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
        texturing=true;
      }
 else {
        texturing=false;
      }
    }
 else {
      texturing=false;
    }
    if (vertexBuffer.capacity() == 3 * faceLength[j]) {
      expandBuffers();
    }
    vertexBuffer.rewind();
    colorBuffer.rewind();
    normalBuffer.rewind();
    textureBuffer.rewind();
    for (int k=0; k < faceLength[j]; k++) {
      float a[]=vertices[triangles[i][VERTEX1]];
      float b[]=vertices[triangles[i][VERTEX2]];
      float c[]=vertices[triangles[i][VERTEX3]];
      float uscale=1.0f;
      float vscale=1.0f;
      float cx=0.0f;
      float sx=+1.0f;
      float cy=0.0f;
      float sy=+1.0f;
      if (texturing) {
        uscale*=tex.getMaxTextureCoordS();
        vscale*=tex.getMaxTextureCoordT();
        if (tex.isFlippedX()) {
          cx=1.0f;
          sx=-1.0f;
        }
        if (tex.isFlippedY()) {
          cy=1.0f;
          sy=-1.0f;
        }
      }
      vertexBuffer.put(toFixed32(a[X]));
      vertexBuffer.put(toFixed32(a[Y]));
      vertexBuffer.put(toFixed32(a[Z]));
      colorBuffer.put(toFixed32(a[R]));
      colorBuffer.put(toFixed32(a[G]));
      colorBuffer.put(toFixed32(a[B]));
      colorBuffer.put(toFixed32(a[A]));
      normalBuffer.put(toFixed32(a[NX]));
      normalBuffer.put(toFixed32(a[NY]));
      normalBuffer.put(toFixed32(a[NZ]));
      textureBuffer.put(toFixed32((cx + sx * a[U]) * uscale));
      textureBuffer.put(toFixed32((cy + sy * a[V]) * vscale));
      vertexBuffer.put(toFixed32(b[X]));
      vertexBuffer.put(toFixed32(b[Y]));
      vertexBuffer.put(toFixed32(b[Z]));
      colorBuffer.put(toFixed32(b[R]));
      colorBuffer.put(toFixed32(b[G]));
      colorBuffer.put(toFixed32(b[B]));
      colorBuffer.put(toFixed32(b[A]));
      normalBuffer.put(toFixed32(b[NX]));
      normalBuffer.put(toFixed32(b[NY]));
      normalBuffer.put(toFixed32(b[NZ]));
      textureBuffer.put(toFixed32((cx + sx * b[U]) * uscale));
      textureBuffer.put(toFixed32((cy + sy * b[V]) * vscale));
      vertexBuffer.put(toFixed32(c[X]));
      vertexBuffer.put(toFixed32(c[Y]));
      vertexBuffer.put(toFixed32(c[Z]));
      colorBuffer.put(toFixed32(c[R]));
      colorBuffer.put(toFixed32(c[G]));
      colorBuffer.put(toFixed32(c[B]));
      colorBuffer.put(toFixed32(c[A]));
      normalBuffer.put(toFixed32(c[NX]));
      normalBuffer.put(toFixed32(c[NY]));
      normalBuffer.put(toFixed32(c[NZ]));
      textureBuffer.put(toFixed32((cx + sx * c[U]) * uscale));
      textureBuffer.put(toFixed32((cy + sy * c[V]) * vscale));
      i++;
    }
    vertexBuffer.position(0);
    colorBuffer.position(0);
    normalBuffer.position(0);
    textureBuffer.position(0);
    gl.glVertexPointer(3,GL10.GL_FIXED,0,vertexBuffer);
    gl.glColorPointer(4,GL10.GL_FIXED,0,colorBuffer);
    gl.glNormalPointer(GL10.GL_FIXED,0,normalBuffer);
    if (texturing)     gl.glTexCoordPointer(2,GL10.GL_FIXED,0,textureBuffer);
    gl.glDrawArrays(GL10.GL_TRIANGLES,0,3 * faceLength[j]);
    if (texturing) {
      gl.glDisable(tex.getGLTarget());
      gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
    }
  }
  gl.glDisableClientState(GL10.GL_NORMAL_ARRAY);
  gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
  gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glPopMatrix();
  report("String_Node_Str");
}

Fixed version (ground truth):
protected void renderTriangles(int start,int stop){
  report("String_Node_Str");
  GLTexture tex=null;
  boolean texturing=false;
  vertexBuffer.position(0);
  colorBuffer.position(0);
  normalBuffer.position(0);
  textureBuffer.position(0);
  gl.glPushMatrix();
  gl.glScalef(1,-1,1);
  gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
  gl.glEnableClientState(GL10.GL_NORMAL_ARRAY);
  for (int j=0; j < faceCount; j++) {
    int i=faceOffset[j];
    if (faceTexture[j] != null) {
      tex=faceTexture[j].getTexture();
      if (tex != null) {
        gl.glEnable(tex.getGLTarget());
        gl.glBindTexture(tex.getGLTarget(),tex.getGLTextureID());
        gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
        texturing=true;
      }
 else {
        texturing=false;
      }
    }
 else {
      texturing=false;
    }
    System.out.println("String_Node_Str" + vertexBuffer.capacity() / 3 + "String_Node_Str" + 3 * faceLength[j]);
    if (vertexBuffer.capacity() / 3 < 3 * faceLength[j]) {
      expandBuffers();
    }
    vertexBuffer.rewind();
    colorBuffer.rewind();
    normalBuffer.rewind();
    textureBuffer.rewind();
    for (int k=0; k < faceLength[j]; k++) {
      float a[]=vertices[triangles[i][VERTEX1]];
      float b[]=vertices[triangles[i][VERTEX2]];
      float c[]=vertices[triangles[i][VERTEX3]];
      float uscale=1.0f;
      float vscale=1.0f;
      float cx=0.0f;
      float sx=+1.0f;
      float cy=0.0f;
      float sy=+1.0f;
      if (texturing) {
        uscale*=tex.getMaxTextureCoordS();
        vscale*=tex.getMaxTextureCoordT();
        if (tex.isFlippedX()) {
          cx=1.0f;
          sx=-1.0f;
        }
        if (tex.isFlippedY()) {
          cy=1.0f;
          sy=-1.0f;
        }
      }
      vertexBuffer.put(toFixed32(a[X]));
      vertexBuffer.put(toFixed32(a[Y]));
      vertexBuffer.put(toFixed32(a[Z]));
      colorBuffer.put(toFixed32(a[R]));
      colorBuffer.put(toFixed32(a[G]));
      colorBuffer.put(toFixed32(a[B]));
      colorBuffer.put(toFixed32(a[A]));
      normalBuffer.put(toFixed32(a[NX]));
      normalBuffer.put(toFixed32(a[NY]));
      normalBuffer.put(toFixed32(a[NZ]));
      textureBuffer.put(toFixed32((cx + sx * a[U]) * uscale));
      textureBuffer.put(toFixed32((cy + sy * a[V]) * vscale));
      vertexBuffer.put(toFixed32(b[X]));
      vertexBuffer.put(toFixed32(b[Y]));
      vertexBuffer.put(toFixed32(b[Z]));
      colorBuffer.put(toFixed32(b[R]));
      colorBuffer.put(toFixed32(b[G]));
      colorBuffer.put(toFixed32(b[B]));
      colorBuffer.put(toFixed32(b[A]));
      normalBuffer.put(toFixed32(b[NX]));
      normalBuffer.put(toFixed32(b[NY]));
      normalBuffer.put(toFixed32(b[NZ]));
      textureBuffer.put(toFixed32((cx + sx * b[U]) * uscale));
      textureBuffer.put(toFixed32((cy + sy * b[V]) * vscale));
      vertexBuffer.put(toFixed32(c[X]));
      vertexBuffer.put(toFixed32(c[Y]));
      vertexBuffer.put(toFixed32(c[Z]));
      colorBuffer.put(toFixed32(c[R]));
      colorBuffer.put(toFixed32(c[G]));
      colorBuffer.put(toFixed32(c[B]));
      colorBuffer.put(toFixed32(c[A]));
      normalBuffer.put(toFixed32(c[NX]));
      normalBuffer.put(toFixed32(c[NY]));
      normalBuffer.put(toFixed32(c[NZ]));
      textureBuffer.put(toFixed32((cx + sx * c[U]) * uscale));
      textureBuffer.put(toFixed32((cy + sy * c[V]) * vscale));
      i++;
    }
    vertexBuffer.position(0);
    colorBuffer.position(0);
    normalBuffer.position(0);
    textureBuffer.position(0);
    gl.glVertexPointer(3,GL10.GL_FIXED,0,vertexBuffer);
    gl.glColorPointer(4,GL10.GL_FIXED,0,colorBuffer);
    gl.glNormalPointer(GL10.GL_FIXED,0,normalBuffer);
    if (texturing)     gl.glTexCoordPointer(2,GL10.GL_FIXED,0,textureBuffer);
    gl.glDrawArrays(GL10.GL_TRIANGLES,0,3 * faceLength[j]);
    if (texturing) {
      gl.glDisable(tex.getGLTarget());
      gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
    }
  }
  gl.glDisableClientState(GL10.GL_NORMAL_ARRAY);
  gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
  gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glPopMatrix();
  report("String_Node_Str");
}