OpenGL Programming/Mini-Portal Optimization
Optimization - the scissors[edit | edit source]
We saw that the scissors were not suited for clipping portals, because scissors can only clip a rectangle. However, scissor clipping is much faster than stencil buffer clipping (it's just a coordinates comparison, rather than a complete screen buffer access).
We can use the scissors to optimize the performances, by doing a first rough clipping, before using the stencil buffer. This will also allow us to detect when a sub-portal is completely hidden and break from the recursive loop.