Boolean operations...

Hi where,
I’m interesting where to get info/samples about boolean operations over 3D objects;
something like glStencilFunc but at object level

Well, for adding two objects (logical OR) just turn on depth buffer and draw both objects. For subtracting object A from B, you could do the following:

-Draw B’s front faces, setting stencil where drawn
-Draw A’s back faces where stencil is set

without depth buffer test.
For a logical AND

-Draw front of A into stencil
-Draw front of B into stencil, increasing
-Draw front faces of A and then B to color buffer where stencil >1, with depth buffer and depth test on

Or something like that
There’s a Demo for CSG operations somewhere, but I forget where to find it.

Hope that helped

No,no,no. I mean not pixel - level operations (that stancil does), but operations with “real” object crossing. I need to SAVE the result of crossing in a file. Thanx anyway

I posted an answer before:


You can also take a look at as there’s a new article from Paul Nettle that explains stuff about this.