Stencil buffer

Is it possible to use the stencil buffer to show from one object only that part that is not in an other object??
Does anybody has an algoritm for that?

This is called constructive solid geometry, dig this site for examples, you’ll find a nice CSG sample using glut.

hope this helps