I’m having some issues adding a “cap” to objects I have clipped (i.e. not exposing the inside). I’ve been working through some examples with the stencil functions, and there are a couple of things I don’t fully understand:

First, I’ve read some examples where to create the cap, a quad is rendered using some set of vertices. I’m not exactly sure where those vertices come from or a good way to create them.

Second, it seems like I need to re-render the object for each clipping plane (I am trying to slice a wedge out of a sphere, which would be the intersection of two clipping planes). The problem is that parts of the objects that are not clipped are rendered twice and this gives a “thicker” look at some parts of the object.

Thank you all very much - any help would be appreciated.

Cass, Thanks for the reply. I’m not familiar with CSG (I’m assuming constructive solid geometry) – is this something I can do in OpenGL or is it just a general technique? Thanks.

So I’ve actually found a solution to my capping problem – the only issue is as follows:

I have a sphere that I have clipped to slice a piece of “pie” out of it. To do this, I had to render the sphere twice - each with a different clipping plane. The only problem is that these spheres are partially transparent and when they mix together they get darker and you can see the boundaries between them – I want to blend them together so the two spheres appear as one – is that possible? Thanks.