What are the benefits of the stencil buffer

I want to create a demo that has something like a cockpit view. I read an ealier topic about adding a background to a scene where you would use an ortho projection for the background and a perspective for everything else.

So the dilemma is, do I use a mask and the stencil buffer for the cockpit, or just draw everything and after that just draw the cockpit over top using an ortho projection?

I have the stencil buffer version working fine but is it worthwhile exploring the other way? I could get rid of the stencil buffer altogether that way, but then why is it common practice to use it in these cases?

Whilst most new hardware has a stencil buffer, lots of oldish video don’t have one in hardware. So the choice is yours.

Usually developers use the second method (the one you haven’t implemented yet

Have you tried benchmarking both alternatives? That could help choose.

Antonio www.fatech.com/tech

Using stencilbuffering will be faster since you don’t need to redraw the cockpit every frame. Stencilbuffering is virtually free if you’d use z-buffering anyway.
But as Pauly said some cards don’t support stenciling eg. Voodoo 3.