Program: 58344
Project: 58344
Buggy source:
private void renderEntry(GL gl,SubMenu subMenu,int elementIndex,float xPosition,float yPosition){
  IContextMenuEntry entry=subMenu.contextMenuEntries.get(elementIndex);
  if (entry instanceof AContextMenuItem) {
    renderItem(gl,subMenu,entry,xPosition,yPosition);
  }
 else   if (entry instanceof Separator) {
    gl.glColor3f(1,1,1);
    gl.glLineStipple(2,(short)0xAAAA);
    gl.glEnable(GL.GL_LINE_STIPPLE);
    gl.glBegin(GL.GL_LINES);
    gl.glVertex3f(subMenu.xOrigin + 2 * SPACING,yPosition + ITEM_HEIGHT / 2,BUTTON_Z);
    gl.glVertex3f(subMenu.xOrigin + subMenu.width - 2 * SPACING,yPosition + ITEM_HEIGHT / 2,BUTTON_Z);
    gl.glEnd();
  }
 else   if (entry instanceof Heading) {
    Heading heading=(Heading)entry;
    textRenderer.begin3DRendering();
    textRenderer.setColor(1,1,1,1);
    gl.glDisable(GL.GL_DEPTH_TEST);
    textRenderer.draw3D(heading.getText(),xPosition,yPosition + SPACING,TEXT_Z,FONT_SCALING);
    textRenderer.end3DRendering();
  }
 else   if (entry instanceof ScrollButton) {
    ScrollButton button=(ScrollButton)entry;
    float top;
    float bottom;
    int iPickingID;
    Texture tempTexture;
    if (button.isUp()) {
      if (!subMenu.scrollButtonUpActive)       return;
      iPickingID=pickingManager.getPickingID(masterGLView.getID(),EPickingType.CONTEXT_MENU_SCROLL_UP,subMenu.contextMenuID);
      bottom=yPosition;
      top=yPosition + ICON_SIZE;
      if (subMenu.scrollButtonUpOver)       tempTexture=iconManager.getIconTexture(gl,EIconTextures.CM_SCROLL_BUTTON_OVER);
 else       tempTexture=iconManager.getIconTexture(gl,EIconTextures.CM_SCROLL_BUTTON);
    }
 else {
      if (!subMenu.scrollButtonDownActive)       return;
      iPickingID=pickingManager.getPickingID(masterGLView.getID(),EPickingType.CONTEXT_MENU_SCROLL_DOWN,subMenu.contextMenuID);
      top=yPosition;
      bottom=yPosition + ICON_SIZE;
      if (subMenu.scrollButtonDownOver)       tempTexture=iconManager.getIconTexture(gl,EIconTextures.CM_SCROLL_BUTTON_OVER);
 else       tempTexture=iconManager.getIconTexture(gl,EIconTextures.CM_SCROLL_BUTTON);
    }
    gl.glPushName(iPickingID);
    gl.glColor4f(1,1,1,0f);
    gl.glBegin(GL.GL_POLYGON);
    gl.glVertex3f(subMenu.xOrigin + 2 * SPACING,yPosition,BUTTON_Z);
    gl.glVertex3f(subMenu.xOrigin + subMenu.width - 2 * SPACING,yPosition,BUTTON_Z);
    gl.glVertex3f(subMenu.xOrigin + subMenu.width - 2 * SPACING,yPosition + ITEM_HEIGHT,BUTTON_Z);
    gl.glVertex3f(subMenu.xOrigin + 2 * SPACING,yPosition + ITEM_HEIGHT,BUTTON_Z);
    gl.glEnd();
    float center=subMenu.xOrigin + subMenu.width / 2;
    tempTexture.enable();
    tempTexture.bind();
    TextureCoords texCoords=tempTexture.getImageTexCoords();
    gl.glColor4f(1,1,1,1f);
    gl.glBegin(GL.GL_POLYGON);
    gl.glTexCoord2f(texCoords.left(),texCoords.bottom());
    gl.glVertex3f(center - ITEM_HEIGHT / 2,bottom,BUTTON_Z);
    gl.glTexCoord2f(texCoords.right(),texCoords.bottom());
    gl.glVertex3f(center + ITEM_HEIGHT / 2,bottom,BUTTON_Z);
    gl.glTexCoord2f(texCoords.right(),texCoords.top());
    gl.glVertex3f(center + ITEM_HEIGHT / 2,top,BUTTON_Z);
    gl.glTexCoord2f(texCoords.left(),texCoords.top());
    gl.glVertex3f(center - ITEM_HEIGHT / 2,top,BUTTON_Z);
    gl.glEnd();
    tempTexture.disable();
    gl.glPopName();
  }
}

Fixed version (ground truth):
private void renderEntry(GL gl,SubMenu subMenu,int elementIndex,float xPosition,float yPosition){
  IContextMenuEntry entry=subMenu.contextMenuEntries.get(elementIndex);
  if (entry instanceof AContextMenuItem) {
    renderItem(gl,subMenu,entry,xPosition,yPosition);
  }
 else   if (entry instanceof Separator) {
    gl.glPushAttrib(GL.GL_LINE_BIT);
    gl.glColor3f(1,1,1);
    gl.glLineStipple(2,(short)0xAAAA);
    gl.glEnable(GL.GL_LINE_STIPPLE);
    gl.glBegin(GL.GL_LINES);
    gl.glVertex3f(subMenu.xOrigin + 2 * SPACING,yPosition + ITEM_HEIGHT / 2,BUTTON_Z);
    gl.glVertex3f(subMenu.xOrigin + subMenu.width - 2 * SPACING,yPosition + ITEM_HEIGHT / 2,BUTTON_Z);
    gl.glEnd();
    gl.glPopAttrib();
  }
 else   if (entry instanceof Heading) {
    Heading heading=(Heading)entry;
    textRenderer.begin3DRendering();
    textRenderer.setColor(1,1,1,1);
    gl.glDisable(GL.GL_DEPTH_TEST);
    textRenderer.draw3D(heading.getText(),xPosition,yPosition + SPACING,TEXT_Z,FONT_SCALING);
    textRenderer.end3DRendering();
  }
 else   if (entry instanceof ScrollButton) {
    ScrollButton button=(ScrollButton)entry;
    float top;
    float bottom;
    int iPickingID;
    Texture tempTexture;
    if (button.isUp()) {
      if (!subMenu.scrollButtonUpActive)       return;
      iPickingID=pickingManager.getPickingID(masterGLView.getID(),EPickingType.CONTEXT_MENU_SCROLL_UP,subMenu.contextMenuID);
      bottom=yPosition;
      top=yPosition + ICON_SIZE;
      if (subMenu.scrollButtonUpOver)       tempTexture=iconManager.getIconTexture(gl,EIconTextures.CM_SCROLL_BUTTON_OVER);
 else       tempTexture=iconManager.getIconTexture(gl,EIconTextures.CM_SCROLL_BUTTON);
    }
 else {
      if (!subMenu.scrollButtonDownActive)       return;
      iPickingID=pickingManager.getPickingID(masterGLView.getID(),EPickingType.CONTEXT_MENU_SCROLL_DOWN,subMenu.contextMenuID);
      top=yPosition;
      bottom=yPosition + ICON_SIZE;
      if (subMenu.scrollButtonDownOver)       tempTexture=iconManager.getIconTexture(gl,EIconTextures.CM_SCROLL_BUTTON_OVER);
 else       tempTexture=iconManager.getIconTexture(gl,EIconTextures.CM_SCROLL_BUTTON);
    }
    gl.glPushName(iPickingID);
    gl.glColor4f(1,1,1,0f);
    gl.glBegin(GL.GL_POLYGON);
    gl.glVertex3f(subMenu.xOrigin + 2 * SPACING,yPosition,BUTTON_Z);
    gl.glVertex3f(subMenu.xOrigin + subMenu.width - 2 * SPACING,yPosition,BUTTON_Z);
    gl.glVertex3f(subMenu.xOrigin + subMenu.width - 2 * SPACING,yPosition + ITEM_HEIGHT,BUTTON_Z);
    gl.glVertex3f(subMenu.xOrigin + 2 * SPACING,yPosition + ITEM_HEIGHT,BUTTON_Z);
    gl.glEnd();
    float center=subMenu.xOrigin + subMenu.width / 2;
    tempTexture.enable();
    tempTexture.bind();
    TextureCoords texCoords=tempTexture.getImageTexCoords();
    gl.glColor4f(1,1,1,1f);
    gl.glBegin(GL.GL_POLYGON);
    gl.glTexCoord2f(texCoords.left(),texCoords.bottom());
    gl.glVertex3f(center - ITEM_HEIGHT / 2,bottom,BUTTON_Z);
    gl.glTexCoord2f(texCoords.right(),texCoords.bottom());
    gl.glVertex3f(center + ITEM_HEIGHT / 2,bottom,BUTTON_Z);
    gl.glTexCoord2f(texCoords.right(),texCoords.top());
    gl.glVertex3f(center + ITEM_HEIGHT / 2,top,BUTTON_Z);
    gl.glTexCoord2f(texCoords.left(),texCoords.top());
    gl.glVertex3f(center - ITEM_HEIGHT / 2,top,BUTTON_Z);
    gl.glEnd();
    tempTexture.disable();
    gl.glPopName();
  }
}