Multiple mirrors

Hi everyone!

I need to create a mirror maze. The problem is that I don’t know how to make facing walls that reflect each others’ reflections as well as the objects in between them. I found an example in C++ which uses the stencil buffer, but as far as I can understand, it works in a way that draws the reflection first (the drawing is restricted to the mirror surface) and then the original object, therefore I assume that my problem cannot be solved this way because it would involve drawing an infinite number of layers in all the mirrors. I’ve also found another example in C which I still don’t understand, but I’m working on it, and I’ll paste that if needed. I’m an absolute beginner, the coding language can be any. Any help would be highly appreciated.