PDA

View Full Version : What are the benefits of the stencil buffer



SuperFly
10-17-2000, 07:38 AM
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?

Pauly
10-17-2000, 09:03 AM
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 http://www.opengl.org/discussion_boards/ubb/rolleyes.gif

Antonio
10-18-2000, 03:33 PM
Have you tried benchmarking both alternatives? That could help choose.


Antonio www.fatech.com/tech (http://www.fatech.com/tech)

Humus
10-19-2000, 06:05 AM
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.