Program: 58489
Project: 58489
Buggy source:
/** 
 * Init Selection textures, build array of textures used for holding the whole examples
 * @param gl
 */
private void initSelectionTextures(){
  int ix=0;
  int iy=0;
  float xnormalized=0.0f;
  float ynormalized=0.0f;
  float fSelectionFaktor=1.0f;
  float[] fArRgbaWhite={1.0f,1.0f,1.0f,1f};
  float fBaseOpacity=0.5f;
  float fAddOpacity=0.05f;
  float[] fBlackColor={0.0f,0.0f,0.0f};
  fSelectionFaktor=2.0f;
  fArRgbaWhite=new float[]{1.0f,1.0f,1.0f,0f};
  int StartindexX=0;
  int StartindexY=0;
  int EndindexX=StartindexX + NR_TEXTURESX - 1;
  int EndindexY=StartindexY + NR_TEXTURESY - 1;
  if (EndindexX >= MAX_AXES) {
    EndindexX=MAX_AXES - 1;
    renderStyle.setTextureNr(EndindexX - StartindexX + 1,NR_TEXTURESY);
  }
  if (EndindexY >= MAX_AXES) {
    EndindexY=MAX_AXES - 1;
    renderStyle.setTextureNr(NR_TEXTURESX,EndindexY - StartindexY + 1);
  }
  AlSelectionTextures.clear();
  float fGlobalTexturePointsX=iTextureSize / fSelectionFaktor;
  float fGlobalTexturePointsY=iTextureSize / fSelectionFaktor;
  int iTextureWidth=(int)(fGlobalTexturePointsX / (double)NR_TEXTURESX);
  int iTextureHeight=(int)(fGlobalTexturePointsY / (double)NR_TEXTURESY);
  int TextureSize=iTextureWidth * iTextureHeight;
  FloatBuffer FbTemp=BufferUtil.newFloatBuffer(TextureSize * 4);
  Texture tempTextur;
  for (Integer iAxisY=StartindexY; iAxisY <= EndindexY; iAxisY++) {
    for (Integer iAxisX=StartindexX; iAxisX <= EndindexX; iAxisX++) {
      for (Integer i=0; i < TextureSize; i++) {
        FbTemp.put(fArRgbaWhite);
      }
      if (true) {
        for (        SelectionType tmpSelectionType : AlSelectionTypes) {
          Collection<Integer> selectionSet=elementSelectionManager.getElements(tmpSelectionType);
          for (          Integer iContentIndex : selectionSet) {
            int current_SELECTED_X_AXIS=iAxisX;
            int current_SELECTED_Y_AXIS=iAxisY;
            xnormalized=set.get(current_SELECTED_X_AXIS).getFloat(EDataRepresentation.NORMALIZED,iContentIndex);
            ynormalized=set.get(current_SELECTED_Y_AXIS).getFloat(EDataRepresentation.NORMALIZED,iContentIndex);
            ix=(int)Math.floor(xnormalized * (double)(iTextureWidth - 1));
            iy=ix * (iTextureWidth) * 4 + (int)Math.floor(ynormalized * (double)(iTextureHeight - 1)) * 4;
            float[] fArMappingColor=tmpSelectionType.getColor();
            if (iy >= TextureSize * 4 - 4) {
              iy=0;
            }
            FbTemp.put(iy,fArMappingColor[0]);
            FbTemp.put(iy + 1,fArMappingColor[1]);
            FbTemp.put(iy + 2,fArMappingColor[2]);
            float fcurrentOpacity=FbTemp.get(iy + 3);
            if (fcurrentOpacity < fBaseOpacity)             fcurrentOpacity=fBaseOpacity;
 else             fcurrentOpacity+=fAddOpacity;
            if (fcurrentOpacity >= 1)             fcurrentOpacity=1;
            FbTemp.put(iy + 3,fcurrentOpacity);
          }
        }
        FbTemp.rewind();
      }
      TextureData texData=new TextureData(GL.GL_RGBA,iTextureWidth,iTextureHeight,0,GL.GL_RGBA,GL.GL_FLOAT,false,false,true,FbTemp,null);
      tempTextur=TextureIO.newTexture(0);
      tempTextur.updateImage(texData);
      AlSelectionTextures.add(tempTextur);
    }
  }
}

Fixed version (ground truth):
/** 
 * Init Selection textures, build array of textures used for holding the whole examples
 * @param gl
 */
private void initSelectionTextures(){
  int ix=0;
  int iy=0;
  float xnormalized=0.0f;
  float ynormalized=0.0f;
  float fSelectionFaktor=1.0f;
  float[] fArRgbaWhite={1.0f,1.0f,1.0f,1f};
  float fBaseOpacity=0.5f;
  float fAddOpacity=0.05f;
  float[] fBlackColor={0.0f,0.0f,0.0f};
  fSelectionFaktor=2.0f;
  fArRgbaWhite=new float[]{1.0f,1.0f,1.0f,0f};
  int StartindexX=0;
  int StartindexY=0;
  int EndindexX=StartindexX + NR_TEXTURESX - 1;
  int EndindexY=StartindexY + NR_TEXTURESY - 1;
  if (EndindexX >= MAX_AXES) {
    EndindexX=MAX_AXES - 1;
    renderStyle.setTextureNr(EndindexX - StartindexX + 1,NR_TEXTURESY);
  }
  if (EndindexY >= MAX_AXES) {
    EndindexY=MAX_AXES - 1;
    renderStyle.setTextureNr(NR_TEXTURESX,EndindexY - StartindexY + 1);
  }
  AlSelectionTextures.clear();
  float fGlobalTexturePointsX=iTextureSize / fSelectionFaktor;
  float fGlobalTexturePointsY=iTextureSize / fSelectionFaktor;
  int iTextureWidth=(int)(fGlobalTexturePointsX / (double)NR_TEXTURESX);
  int iTextureHeight=(int)(fGlobalTexturePointsY / (double)NR_TEXTURESY);
  int TextureSize=iTextureWidth * iTextureHeight;
  FloatBuffer FbTemp=BufferUtil.newFloatBuffer(TextureSize * 4);
  Texture tempTextur;
  for (Integer iAxisY=StartindexY; iAxisY <= EndindexY; iAxisY++) {
    for (Integer iAxisX=StartindexX; iAxisX <= EndindexX; iAxisX++) {
      for (Integer i=0; i < TextureSize; i++) {
        FbTemp.put(fArRgbaWhite);
      }
      if (true) {
        for (        SelectionType tmpSelectionType : AlSelectionTypes) {
          Collection<Integer> selectionSet=elementSelectionManager.getElements(tmpSelectionType);
          for (          Integer iContentIndex : selectionSet) {
            int current_SELECTED_X_AXIS=iAxisX;
            int current_SELECTED_Y_AXIS=iAxisY;
            xnormalized=set.get(storageVA.get(current_SELECTED_X_AXIS)).getFloat(EDataRepresentation.NORMALIZED,iContentIndex);
            ynormalized=set.get(storageVA.get(current_SELECTED_Y_AXIS)).getFloat(EDataRepresentation.NORMALIZED,iContentIndex);
            ix=(int)Math.floor(xnormalized * (double)(iTextureWidth - 1));
            iy=ix * (iTextureWidth) * 4 + (int)Math.floor(ynormalized * (double)(iTextureHeight - 1)) * 4;
            float[] fArMappingColor=tmpSelectionType.getColor();
            if (iy >= TextureSize * 4 - 4) {
              iy=0;
            }
            FbTemp.put(iy,fArMappingColor[0]);
            FbTemp.put(iy + 1,fArMappingColor[1]);
            FbTemp.put(iy + 2,fArMappingColor[2]);
            float fcurrentOpacity=FbTemp.get(iy + 3);
            if (fcurrentOpacity < fBaseOpacity)             fcurrentOpacity=fBaseOpacity;
 else             fcurrentOpacity+=fAddOpacity;
            if (fcurrentOpacity >= 1)             fcurrentOpacity=1;
            FbTemp.put(iy + 3,fcurrentOpacity);
          }
        }
        FbTemp.rewind();
      }
      TextureData texData=new TextureData(GL.GL_RGBA,iTextureWidth,iTextureHeight,0,GL.GL_RGBA,GL.GL_FLOAT,false,false,true,FbTemp,null);
      tempTextur=TextureIO.newTexture(0);
      tempTextur.updateImage(texData);
      AlSelectionTextures.add(tempTextur);
    }
  }
}