Hello, everyone. I'm very inexperienced in OpenGL and graphics programming in general but I am trying to do an implementation of horizon-based ambient occlusion. The problem is that I don't know how to use or copy the depth buffer to a texture, send that texture to the fragment shader, or access textures in the fragment shader. I am using C/C++.

Can anybody point me to a good piece of sample code that shows this sort of thing being done? Something where the code is understandable and relatively straightforward in implementation? If not that, is there any good book or other source that clearly explains these things to total novices such as myself?

If anybody could help, I would be most grateful!