ok, i'm posting the code.
https://github.com/giacomo986/trueportals
This code is uncommented but I'll try to explain here:
- the area is rendered multiple times.
- to render again the world i cloned some render function.
- to detect where to render i used opengl stencil functions
the best thing in that the portal works for all entity in game like mob or arrows.
If you need more explanations, ask here because it takes me a lot of time to write down all comments of the code