Program: 70854
Project: 70854
Buggy source:
private void doDisplay(GLAutoDrawable drawable,int flags){
  GLSupport.checkAndPrintGLError(drawable.getGL());
  int mclips=Math.min(2 * myClipPlanes.size(),maxClipPlanes);
  progManager.reconfigure(gl,lightManager.numLights(),mclips);
  progManager.setLights(gl,lightManager.getLights(),1.0f / lightManager.getMaxIntensity(),viewMatrix);
  maybeUpdateState(gl);
  GL3 gl3=drawable.getGL().getGL3();
  if (!isSelecting()) {
    gl3.glClearColor(bgColor[0],bgColor[1],bgColor[2],bgColor[3]);
  }
  gl3.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
  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);
    }
  }
  GLSupport.checkAndPrintGLError(gl);
  int nclips=0;
  if (myClipPlanes.size() > 0) {
    nclips=progManager.setClipPlanes(gl3,myClipPlanes);
    for (int i=0; i < nclips; ++i) {
      gl.glEnable(GL3.GL_CLIP_DISTANCE0 + i);
    }
  }
  GLSupport.checkAndPrintGLError(gl);
  int qid=0;
synchronized (renderablesLock) {
    qid=myInternalRenderList.renderOpaque(this,qid,flags);
    if (myExternalRenderList != null) {
      qid=myExternalRenderList.renderOpaque(this,qid,flags);
    }
  }
  GLSupport.checkAndPrintGLError(gl);
  if (hasTransparent3d()) {
    if (!isSelecting()) {
      enableTransparency(gl);
    }
synchronized (renderablesLock) {
      qid=myInternalRenderList.renderTransparent(this,qid,flags);
      if (myExternalRenderList != null) {
        qid=myExternalRenderList.renderTransparent(this,qid,flags);
      }
    }
    disableTransparency(gl);
  }
  GLSupport.checkAndPrintGLError(gl);
  for (int i=0; i < nclips; ++i) {
    gl.glDisable(GL3.GL_CLIP_DISTANCE0 + i);
  }
  GLSupport.checkAndPrintGLError(gl);
  if (has2d()) {
    begin2DRendering(width,height);
synchronized (renderablesLock) {
      qid=myInternalRenderList.renderOpaque2d(this,qid,0);
      if (myExternalRenderList != null) {
        qid=myExternalRenderList.renderOpaque2d(this,qid,0);
      }
    }
    if (hasTransparent2d()) {
      enableTransparency(gl);
synchronized (renderablesLock) {
        qid=myInternalRenderList.renderTransparent2d(this,qid,0);
        if (myExternalRenderList != null) {
          qid=myExternalRenderList.renderTransparent2d(this,qid,0);
        }
      }
      disableTransparency(gl);
    }
    end2DRendering();
  }
  GLSupport.checkAndPrintGLError(gl);
  if (!isSelecting()) {
    if (myDragBox != null) {
      drawDragBox(drawable);
    }
  }
 else {
    gl.glClearColor(bgColor[0],bgColor[1],bgColor[2],bgColor[3]);
  }
  GLSupport.checkAndPrintGLError(gl);
  gl3.glFlush();
  GLSupport.checkAndPrintGLError(gl);
}

Fixed version (ground truth):
private void doDisplay(GLAutoDrawable drawable,int flags){
  GLSupport.checkAndPrintGLError(drawable.getGL());
  int mclips=Math.min(2 * myClipPlanes.size(),maxClipPlanes);
  progManager.reconfigure(gl,lightManager.numLights(),mclips);
  progManager.setLights(gl,lightManager.getLights(),1.0f / lightManager.getMaxIntensity(),viewMatrix);
  maybeUpdateState(gl);
  GL3 gl3=drawable.getGL().getGL3();
  if (!isSelecting()) {
    gl3.glClearColor(bgColor[0],bgColor[1],bgColor[2],bgColor[3]);
  }
  gl3.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
  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);
    }
  }
  GLSupport.checkAndPrintGLError(gl);
  int nclips=0;
  if (myClipPlanes.size() > 0) {
    nclips=progManager.setClipPlanes(gl3,myClipPlanes);
    for (int i=0; i < nclips; ++i) {
      gl.glEnable(GL3.GL_CLIP_DISTANCE0 + i);
    }
  }
  GLSupport.checkAndPrintGLError(gl);
  int qid=0;
synchronized (renderablesLock) {
    qid=myInternalRenderList.renderOpaque(this,qid,flags);
    if (myExternalRenderList != null) {
      qid=myExternalRenderList.renderOpaque(this,qid,flags);
    }
  }
  GLSupport.checkAndPrintGLError(gl);
  if (hasTransparent3d()) {
    if (!isSelecting()) {
      enableTransparency(gl);
    }
synchronized (renderablesLock) {
      qid=myInternalRenderList.renderTransparent(this,qid,flags);
      if (myExternalRenderList != null) {
        qid=myExternalRenderList.renderTransparent(this,qid,flags);
      }
    }
    if (!isSelecting()) {
      disableTransparency(gl);
    }
  }
  GLSupport.checkAndPrintGLError(gl);
  for (int i=0; i < nclips; ++i) {
    gl.glDisable(GL3.GL_CLIP_DISTANCE0 + i);
  }
  GLSupport.checkAndPrintGLError(gl);
  if (has2d()) {
    begin2DRendering(width,height);
synchronized (renderablesLock) {
      qid=myInternalRenderList.renderOpaque2d(this,qid,0);
      if (myExternalRenderList != null) {
        qid=myExternalRenderList.renderOpaque2d(this,qid,0);
      }
    }
    if (hasTransparent2d()) {
      enableTransparency(gl);
synchronized (renderablesLock) {
        qid=myInternalRenderList.renderTransparent2d(this,qid,0);
        if (myExternalRenderList != null) {
          qid=myExternalRenderList.renderTransparent2d(this,qid,0);
        }
      }
      disableTransparency(gl);
    }
    end2DRendering();
  }
  GLSupport.checkAndPrintGLError(gl);
  if (!isSelecting()) {
    if (myDragBox != null) {
      drawDragBox(drawable);
    }
  }
 else {
    gl.glClearColor(bgColor[0],bgColor[1],bgColor[2],bgColor[3]);
  }
  GLSupport.checkAndPrintGLError(gl);
  gl3.glFlush();
  GLSupport.checkAndPrintGLError(gl);
}