How does 3D example work?

I had quite fun toying around with 3D example (Wolfenstein style 3D engine.gdg), but how does it exactly work? I have troubles understanding events behind it and I’d like to do some 3D sequence in my game using this.