void OpenGLInterface::printHistogram(Histogram &histogram, FigureRectangle rectangle) { /* Put coursor back to (0, 0, 0) */ glLoadIdentity(); int numberOfBins = histogram.getNumberOfArguments(); int numberOfCharts = histogram.getNumberOfCharts(); double binWidth = 1 / double(numberOfBins); drawArgumentLabels(histogram.getMinArgument(), histogram.getMaxArgument(), 4, rectangle); drawValueLabels(histogram.getMinValue(), histogram.getMaxValue(), 4, rectangle); rectangle.resize(0.93, 0.93); glEnable(GL_ALPHA_TEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA); double leftDownX = rectangle.getMiddleX() - rectangle.getSizeX() / 2; double leftDownY = rectangle.getMiddleY() - rectangle.getSizeY() / 2; double sizeX = rectangle.getSizeX(); double sizeY = rectangle.getSizeY(); double sideGap = configurator->getSideGap(); for(int j = 0; j < numberOfCharts; j++) { FigureRectangle histogramColumn; Color color = histogram.getColor(j); histogramColumn.setColor(color); for(int i = 0; i < numberOfBins; i++) { histogramColumn.setFigure(leftDownX + i * binWidth * sizeX, leftDownY, leftDownX + ((i + 1) * binWidth - binWidth * sideGap) * sizeX, leftDownY + histogram.getValue(j, i) / histogram.getMaxValue() * sizeY); drawRectangle(histogramColumn); } } glDisable(GL_BLEND); glDisable(GL_ALPHA_TEST); }