Program: 70793
Project: 70793
Buggy source:
@Override public void drawTriangles(RenderObject robj,int gidx){
  if (!robj.hasTriangles()) {
    return;
  }
  boolean enableLighting=false;
  if (isLightingEnabled() && !robj.hasNormals()) {
    enableLighting=true;
    setLightingEnabled(false);
  }
  maybeUpdateState(gl);
  boolean selecting=isSelecting();
  boolean hasColors=(robj.hasColors() && hasVertexColoring());
  boolean useColors=hasColors && !selecting;
  boolean useHSV=isHSVColorInterpolationEnabled() && !isLightingEnabled();
  if (useColors) {
    gl.glColorMaterial(GL2.GL_FRONT_AND_BACK,GL2.GL_AMBIENT_AND_DIFFUSE);
    if (!myHighlightColorActive) {
      gl.glEnable(GL2.GL_COLOR_MATERIAL);
    }
    if (useHSV) {
      useHSV=setupHSVInterpolation(gl);
    }
  }
  boolean useDisplayList=!selecting || !hasColors;
  GL2VersionedObject gvo=null;
  GLTexture tex=null;
  if (myColorMapProps != null && myColorMapProps.isEnabled() && robj.hasTextureCoords()) {
    tex=myGLResources.getOrLoadTexture(gl,myColorMapProps.getContent());
    if (tex != null) {
      gl.glEnable(GL.GL_TEXTURE_2D);
      gl.glActiveTexture(GL.GL_TEXTURE0);
      gl.glTexEnvi(GL2.GL_TEXTURE_ENV,GL2.GL_TEXTURE_ENV_MODE,getTextureMode(myColorMapProps));
      tex.bind(gl);
    }
  }
  RenderObjectVersion fingerprint=robj.getVersionInfo();
  RenderObjectKey key=new RenderObjectKey(robj.getIdentifier(),DrawType.TRIANGLES,gidx);
  boolean compile=true;
  if (useDisplayList) {
    gvo=myGLResources.getVersionedObject(key);
    if (gvo != null) {
      boolean iv=gvo.disposeInvalid(gl);
      if (iv == true) {
        System.out.println("String_Node_Str" + gvo);
      }
    }
    if (gvo == null || gvo.disposeInvalid(gl)) {
      gvo=myGLResources.allocateVersionedObject(gl,key,fingerprint);
      compile=true;
    }
 else {
      compile=!(gvo.compareExchangeFingerPrint(fingerprint));
    }
  }
  if (compile) {
    if (DEBUG) {
      System.out.println("String_Node_Str" + gvo.getDisplayList().getListId());
    }
    if (gvo != null) {
      gvo.beginCompile(gl);
    }
    gl.glBegin(GL.GL_TRIANGLES);
    robj.readLock();
    int[] tris=robj.getTriangles(gidx);
    int triangleCount=robj.numTriangles(gidx);
    int triangleStride=robj.getTriangleStride();
    int idx=0;
    for (int i=0; i < triangleCount; ++i) {
      idx=i * triangleStride;
      for (int j=0; j < triangleStride; ++j) {
        int vidx=tris[idx + j];
        if (!selecting && useColors) {
          robj.getVertexColor(vidx);
          setVertexColor(gl,robj.getVertexColor(vidx),useHSV);
        }
        if (robj.hasNormals()) {
          gl.glNormal3fv(robj.getVertexNormal(vidx),0);
        }
        if (robj.hasTextureCoords()) {
          gl.glTexCoord2fv(robj.getVertexTextureCoord(vidx),0);
        }
        gl.glVertex3fv(robj.getVertexPosition(vidx),0);
      }
    }
    robj.readUnlock();
    gl.glEnd();
    if (gvo != null) {
      gvo.endCompile(gl);
      gvo.draw(gl);
    }
  }
 else {
    gvo.draw(gl);
  }
  if (tex != null) {
    tex.unbind(gl);
    gl.glDisable(GL.GL_TEXTURE_2D);
  }
  if (useColors) {
    gl.glDisable(GL2.GL_COLOR_MATERIAL);
    if (useHSV) {
      gl.glUseProgramObjectARB(0);
    }
  }
  if (enableLighting) {
    setLightingEnabled(true);
  }
}

Fixed version (ground truth):
@Override public void drawTriangles(RenderObject robj,int gidx){
  if (!robj.hasTriangles()) {
    return;
  }
  boolean enableLighting=false;
  if (isLightingEnabled() && !robj.hasNormals()) {
    enableLighting=true;
    setLightingEnabled(false);
  }
  maybeUpdateState(gl);
  boolean selecting=isSelecting();
  boolean hasColors=(robj.hasColors() && hasVertexColoring());
  boolean useColors=hasColors && !selecting;
  boolean useHSV=isHSVColorInterpolationEnabled();
  if (useColors) {
    gl.glColorMaterial(GL2.GL_FRONT_AND_BACK,GL2.GL_AMBIENT_AND_DIFFUSE);
    if (!myHighlightColorActive) {
      gl.glEnable(GL2.GL_COLOR_MATERIAL);
    }
    if (useHSV) {
      useHSV=setupHSVInterpolation(gl);
    }
  }
  boolean useDisplayList=!selecting || !hasColors;
  GL2VersionedObject gvo=null;
  GLTexture tex=null;
  if (myColorMapProps != null && myColorMapProps.isEnabled() && robj.hasTextureCoords()) {
    tex=myGLResources.getOrLoadTexture(gl,myColorMapProps.getContent());
    if (tex != null) {
      gl.glEnable(GL.GL_TEXTURE_2D);
      gl.glActiveTexture(GL.GL_TEXTURE0);
      gl.glTexEnvi(GL2.GL_TEXTURE_ENV,GL2.GL_TEXTURE_ENV_MODE,getTextureMode(myColorMapProps));
      tex.bind(gl);
    }
  }
  RenderObjectVersion fingerprint=robj.getVersionInfo();
  RenderObjectKey key=new RenderObjectKey(robj.getIdentifier(),DrawType.TRIANGLES,gidx);
  boolean compile=true;
  if (useDisplayList) {
    gvo=myGLResources.getVersionedObject(key);
    if (gvo != null) {
      boolean iv=gvo.disposeInvalid(gl);
      if (iv == true) {
        System.out.println("String_Node_Str" + gvo);
      }
    }
    if (gvo == null || gvo.disposeInvalid(gl)) {
      gvo=myGLResources.allocateVersionedObject(gl,key,fingerprint);
      compile=true;
    }
 else {
      compile=!(gvo.compareExchangeFingerPrint(fingerprint));
    }
  }
  if (compile) {
    if (DEBUG) {
      System.out.println("String_Node_Str" + gvo.getDisplayList().getListId());
    }
    if (gvo != null) {
      gvo.beginCompile(gl);
    }
    gl.glBegin(GL.GL_TRIANGLES);
    robj.readLock();
    int[] tris=robj.getTriangles(gidx);
    int triangleCount=robj.numTriangles(gidx);
    int triangleStride=robj.getTriangleStride();
    int idx=0;
    for (int i=0; i < triangleCount; ++i) {
      idx=i * triangleStride;
      for (int j=0; j < triangleStride; ++j) {
        int vidx=tris[idx + j];
        if (!selecting && useColors) {
          robj.getVertexColor(vidx);
          setVertexColor(gl,robj.getVertexColor(vidx),useHSV);
        }
        if (robj.hasNormals()) {
          gl.glNormal3fv(robj.getVertexNormal(vidx),0);
        }
        if (robj.hasTextureCoords()) {
          gl.glTexCoord2fv(robj.getVertexTextureCoord(vidx),0);
        }
        gl.glVertex3fv(robj.getVertexPosition(vidx),0);
      }
    }
    robj.readUnlock();
    gl.glEnd();
    if (gvo != null) {
      gvo.endCompile(gl);
      gvo.draw(gl);
    }
  }
 else {
    gvo.draw(gl);
  }
  if (tex != null) {
    tex.unbind(gl);
    gl.glDisable(GL.GL_TEXTURE_2D);
  }
  if (useColors) {
    gl.glDisable(GL2.GL_COLOR_MATERIAL);
    if (useHSV) {
      gl.glUseProgramObjectARB(0);
    }
  }
  if (enableLighting) {
    setLightingEnabled(true);
  }
}