Reading pixel intensities from a displayed image

I want to create a histogram of intensities 0.1, 0.2, … 0.9, 1, from an image rendered using OpenGL and C++. How can I do this? Can I access the pixel intensities in the framebuffer somehow? Also, I am not using any GLSL shaders.

Use glReadPixels() to read the data.