Program: 70758
Project: 70758
Buggy source:
public void doDisplay(GLAutoDrawable drawable,int flags){
  GL2 gl=drawable.getGL().getGL2();
  if (resetViewVolume && resizeEnabled) {
    resetViewVolume(gl);
    resetViewVolume=false;
  }
  if (isSelecting()) {
    gl.glClearColor(0f,0f,0f,0f);
  }
 else {
    gl.glClearColor(backgroundColor[0],backgroundColor[1],backgroundColor[2],backgroundColor[3]);
  }
  gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
  maybeUpdateState(gl);
  setupLights(gl);
  if (!isSelecting()) {
    if (gridVisible) {
      myGrid.render(this,flags);
    }
    if (axisLength > 0) {
      drawAxes(gl,axisLength);
    }
    for (    Dragger3d dragger : myDraggers) {
      dragger.render(this,0);
    }
    if (myDrawTool != null) {
      myDrawTool.render(this,0);
    }
    for (    GLClipPlane cp : myClipPlanes) {
      cp.render(this,flags);
    }
  }
  int nclips=0;
  int clipIdx=GL2.GL_CLIP_PLANE0;
  for (  GLClipPlane cp : myClipPlanes) {
    if (cp.isClippingEnabled()) {
      cp.getPlaneValues(myClipPlaneValues);
      myClipPlaneValues[3]+=cp.getOffset();
      gl.glClipPlane(clipIdx,myClipPlaneValues,0);
      gl.glEnable(clipIdx);
      clipIdx++;
      nclips++;
      if (nclips >= maxClipPlanes) {
        break;
      }
      if (cp.isSlicingEnabled()) {
        myClipPlaneValues[0]=-myClipPlaneValues[0];
        myClipPlaneValues[1]=-myClipPlaneValues[1];
        myClipPlaneValues[2]=-myClipPlaneValues[2];
        myClipPlaneValues[3]=-myClipPlaneValues[3] + 2 * cp.getOffset();
        gl.glClipPlane(clipIdx,myClipPlaneValues,0);
        gl.glEnable(clipIdx);
        clipIdx++;
        nclips++;
        if (nclips >= maxClipPlanes) {
          break;
        }
      }
    }
  }
  int qid=0;
synchronized (myInternalRenderList) {
    qid=myInternalRenderList.renderOpaque(this,qid,flags);
  }
  RenderList elist=myExternalRenderList;
  if (elist != null) {
synchronized (elist) {
      qid=elist.renderOpaque(this,qid,flags);
    }
  }
  if (hasTransparent3d()) {
    boolean transparencyEnabled=false;
    if (!isSelecting()) {
      enableTransparency(gl);
      transparencyEnabled=true;
    }
synchronized (myInternalRenderList) {
      qid=myInternalRenderList.renderTransparent(this,qid,flags);
    }
    if (elist != null) {
synchronized (elist) {
        qid=elist.renderTransparent(this,qid,flags);
      }
    }
    if (transparencyEnabled) {
      disableTransparency(gl);
      transparencyEnabled=false;
    }
  }
  for (int i=GL2.GL_CLIP_PLANE0; i < clipIdx; ++i) {
    gl.glDisable(i);
  }
  if (has2d()) {
    begin2DRendering(width,height);
synchronized (myInternalRenderList) {
      qid=myInternalRenderList.renderOpaque2d(this,qid,0);
    }
    if (elist != null) {
synchronized (elist) {
        qid=elist.renderOpaque2d(this,qid,0);
      }
    }
    if (hasTransparent2d()) {
      boolean transparencyEnabled=false;
      if (!isSelecting()) {
        enableTransparency(gl);
        transparencyEnabled=true;
      }
synchronized (myInternalRenderList) {
        qid=myInternalRenderList.renderTransparent2d(this,qid,0);
      }
      if (elist != null) {
synchronized (elist) {
          qid=elist.renderTransparent2d(this,qid,0);
        }
      }
      if (transparencyEnabled) {
        disableTransparency(gl);
        transparencyEnabled=false;
      }
    }
    end2DRendering();
  }
  if (!isSelecting()) {
    if (myDragBox != null) {
      drawDragBox(gl);
    }
  }
  gl.glFlush();
}

Fixed version (ground truth):
public void doDisplay(GLAutoDrawable drawable,int flags){
  GL2 gl=drawable.getGL().getGL2();
  if (resetViewVolume && resizeEnabled) {
    resetViewVolume(gl);
    resetViewVolume=false;
  }
  if (isSelecting()) {
    gl.glClearColor(0f,0f,0f,0f);
  }
 else {
    gl.glClearColor(backgroundColor[0],backgroundColor[1],backgroundColor[2],backgroundColor[3]);
  }
  gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
  maybeUpdateState(gl);
  setupLights(gl);
  if (!isSelecting()) {
    if (gridVisible) {
      myGrid.render(this,flags);
    }
    if (axisLength > 0) {
      drawAxes(gl,axisLength);
    }
    for (    Dragger3d dragger : myDraggers) {
      dragger.render(this,0);
    }
    if (myDrawTool != null) {
      myDrawTool.render(this,0);
    }
    for (    GLClipPlane cp : myClipPlanes) {
      cp.render(this,flags);
    }
  }
  int nclips=0;
  int clipIdx=GL2.GL_CLIP_PLANE0;
  for (  GLClipPlane cp : myClipPlanes) {
    if (cp.isClippingEnabled()) {
      cp.getPlaneValues(myClipPlaneValues);
      myClipPlaneValues[3]+=cp.getOffset();
      gl.glClipPlane(clipIdx,myClipPlaneValues,0);
      gl.glEnable(clipIdx);
      clipIdx++;
      nclips++;
      if (nclips >= maxClipPlanes) {
        break;
      }
      if (cp.isSlicingEnabled()) {
        myClipPlaneValues[0]=-myClipPlaneValues[0];
        myClipPlaneValues[1]=-myClipPlaneValues[1];
        myClipPlaneValues[2]=-myClipPlaneValues[2];
        myClipPlaneValues[3]=-myClipPlaneValues[3] + 2 * cp.getOffset();
        gl.glClipPlane(clipIdx,myClipPlaneValues,0);
        gl.glEnable(clipIdx);
        clipIdx++;
        nclips++;
        if (nclips >= maxClipPlanes) {
          break;
        }
      }
    }
  }
  if (!isSelecting()) {
    setFrontColor(DEFAULT_MATERIAL_COLOR);
  }
  int qid=0;
synchronized (myInternalRenderList) {
    qid=myInternalRenderList.renderOpaque(this,qid,flags);
  }
  RenderList elist=myExternalRenderList;
  if (elist != null) {
synchronized (elist) {
      qid=elist.renderOpaque(this,qid,flags);
    }
  }
  if (hasTransparent3d()) {
    boolean transparencyEnabled=false;
    if (!isSelecting()) {
      enableTransparency(gl);
      transparencyEnabled=true;
    }
synchronized (myInternalRenderList) {
      qid=myInternalRenderList.renderTransparent(this,qid,flags);
    }
    if (elist != null) {
synchronized (elist) {
        qid=elist.renderTransparent(this,qid,flags);
      }
    }
    if (transparencyEnabled) {
      disableTransparency(gl);
      transparencyEnabled=false;
    }
  }
  for (int i=GL2.GL_CLIP_PLANE0; i < clipIdx; ++i) {
    gl.glDisable(i);
  }
  if (has2d()) {
    begin2DRendering(width,height);
synchronized (myInternalRenderList) {
      qid=myInternalRenderList.renderOpaque2d(this,qid,0);
    }
    if (elist != null) {
synchronized (elist) {
        qid=elist.renderOpaque2d(this,qid,0);
      }
    }
    if (hasTransparent2d()) {
      boolean transparencyEnabled=false;
      if (!isSelecting()) {
        enableTransparency(gl);
        transparencyEnabled=true;
      }
synchronized (myInternalRenderList) {
        qid=myInternalRenderList.renderTransparent2d(this,qid,0);
      }
      if (elist != null) {
synchronized (elist) {
          qid=elist.renderTransparent2d(this,qid,0);
        }
      }
      if (transparencyEnabled) {
        disableTransparency(gl);
        transparencyEnabled=false;
      }
    }
    end2DRendering();
  }
  if (!isSelecting()) {
    if (myDragBox != null) {
      drawDragBox(gl);
    }
  }
  gl.glFlush();
}