Program: 58516
Project: 58516
Buggy source:
/** 
 * Init textures, build array of textures used for holding the whole examples
 * @param gl
 */
private void initTextures(boolean bIsSelection){
  int ix=0;
  int iy=0;
  float xnormalized=0.0f;
  float ynormalized=0.0f;
  float fSelectionFaktor=1.0f;
  int debugsize1=AlSelectionTextures.size();
  int debugsize2=AlFullTextures.size();
  float[] fArRgbaWhite={1.0f,1.0f,1.0f,1f};
  float fOpacity=1f;
  float[] fSelectionColor={1.0f,0.1f,0.5f};
  float[] fBlackColor={0.0f,0.0f,0.0f};
  int debugsize=0;
  Set<Integer> selectionSet=elementSelectionManager.getAllElements();
  debugsize=selectionSet.size();
  if (bIsSelection) {
    fSelectionFaktor=2.0f;
    fArRgbaWhite=new float[]{1.0f,1.0f,1.0f,0f};
    selectionSet.clear();
    selectionSet=elementSelectionManager.getElements(ESelectionType.SELECTION);
    debugsize=selectionSet.size();
  }
  int StartindexX=0;
  int StartindexY=0;
  int EndindexX=StartindexX + NR_TEXTURESX - 1;
  int EndindexY=StartindexY + NR_TEXTURESY - 1;
  if (EndindexX >= storageVA.size()) {
    EndindexX=storageVA.size() - 1;
    ScatterPlotRenderStyle.setTextureNr(EndindexX - StartindexX + 1,NR_TEXTURESY);
  }
  if (EndindexY >= storageVA.size()) {
    EndindexY=storageVA.size() - 1;
    ScatterPlotRenderStyle.setTextureNr(NR_TEXTURESX,EndindexY - StartindexY + 1);
  }
  if (bIsSelection)   AlSelectionTextures.clear();
 else   AlFullTextures.clear();
  debugsize1=AlSelectionTextures.size();
  debugsize2=AlFullTextures.size();
  float fGlobalTexturePointsX=1000.0f / fSelectionFaktor;
  float fGlobalTexturePointsY=1000.0f / 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);
      }
      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=null;
        if (bIsSelection)         fArMappingColor=fSelectionColor;
 else         if (bUseColorOnMatrix)         fArMappingColor=colorMapper.getColor(Math.max(xnormalized,ynormalized));
 else         fArMappingColor=fBlackColor;
        if (iy >= TextureSize * 4 - 4) {
          iy=0;
        }
        FbTemp.put(iy,fArMappingColor[0]);
        FbTemp.put(iy + 1,fArMappingColor[1]);
        FbTemp.put(iy + 2,fArMappingColor[2]);
        FbTemp.put(iy + 3,fOpacity);
      }
      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);
      if (bIsSelection)       AlSelectionTextures.add(tempTextur);
 else       AlFullTextures.add(tempTextur);
    }
  }
  debugsize1=AlSelectionTextures.size();
  debugsize2=AlFullTextures.size();
}

Fixed version (ground truth):
/** 
 * Init textures, build array of textures used for holding the whole examples
 * @param gl
 */
private void initTextures(boolean bIsSelection){
  int ix=0;
  int iy=0;
  float xnormalized=0.0f;
  float ynormalized=0.0f;
  float fSelectionFaktor=1.0f;
  int debugsize1=AlSelectionTextures.size();
  int debugsize2=AlFullTextures.size();
  float[] fArRgbaWhite={1.0f,1.0f,1.0f,1f};
  float fOpacity=1f;
  float[] fSelectionColor={1.0f,0.1f,0.5f};
  float[] fBlackColor={0.0f,0.0f,0.0f};
  int debugsize=0;
  Set<Integer> selectionSet=elementSelectionManager.getAllElements();
  debugsize=selectionSet.size();
  if (bIsSelection) {
    fSelectionFaktor=2.0f;
    fArRgbaWhite=new float[]{1.0f,1.0f,1.0f,0f};
    selectionSet.clear();
    selectionSet=elementSelectionManager.getElements(ESelectionType.SELECTION);
    debugsize=selectionSet.size();
  }
  int StartindexX=0;
  int StartindexY=0;
  int EndindexX=StartindexX + NR_TEXTURESX - 1;
  int EndindexY=StartindexY + NR_TEXTURESY - 1;
  if (EndindexX >= storageVA.size()) {
    EndindexX=storageVA.size() - 1;
    ScatterPlotRenderStyle.setTextureNr(EndindexX - StartindexX + 1,NR_TEXTURESY);
  }
  if (EndindexY >= storageVA.size()) {
    EndindexY=storageVA.size() - 1;
    ScatterPlotRenderStyle.setTextureNr(NR_TEXTURESX,EndindexY - StartindexY + 1);
  }
  if (bIsSelection)   AlSelectionTextures.clear();
 else   AlFullTextures.clear();
  debugsize1=AlSelectionTextures.size();
  debugsize2=AlFullTextures.size();
  float fGlobalTexturePointsX=1000.0f / fSelectionFaktor;
  float fGlobalTexturePointsY=1000.0f / 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);
      }
      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=null;
        if (bIsSelection)         fArMappingColor=fSelectionColor;
 else         if (bUseColor)         fArMappingColor=colorMapper.getColor(Math.max(xnormalized,ynormalized));
 else         fArMappingColor=fBlackColor;
        if (iy >= TextureSize * 4 - 4) {
          iy=0;
        }
        FbTemp.put(iy,fArMappingColor[0]);
        FbTemp.put(iy + 1,fArMappingColor[1]);
        FbTemp.put(iy + 2,fArMappingColor[2]);
        FbTemp.put(iy + 3,fOpacity);
      }
      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);
      if (bIsSelection)       AlSelectionTextures.add(tempTextur);
 else       AlFullTextures.add(tempTextur);
    }
  }
  debugsize1=AlSelectionTextures.size();
  debugsize2=AlFullTextures.size();
}