10

One possible approach could be the use of Hardware Occlusion Query. You can use the facts that, by specification, the Stencil Test is executed before the depth test, and only the fragments that pass the depth test are counted by the Occlusion Query. A simple example (not tested) would be like: GLuint samples_query = 0; GLuint samples_passed = 0; ...


4

I don't have a definite authoritive answer for you but I'm very confident that the answer is "yes". Here's why: When using framebuffer objects, stencil attachments are usually combined with the depth attachment in a single texture (GL_DEPTH24_STENCIL8 or GL_DEPTH32F_STENCIL8). In fact, until recently, a combined depth and stencil was the only way ...


4

The specification has been clarified on this point, as has the Wiki article. So let's explain that. The new wording in the spec says: the samples-passed count is incremented for each fragment still being processed after the depth test This is better wording, as it makes clear that the order in which things are processed matters. OpenGL defines the depth ...


2

If what you are interested in is the area, you could downsize the stencil buffer until you reach one pixel and deduce that area from its color. Steps would be: Copy the stencil to a texture, using a format with enough precision. Load a shader that outputs a color proportional to the number of texels with a given color. Ping-pong between to framebuffers to ...


1

It sounds like what you need is a scissor test. It's specifically designed for clipping against an unrotated rectangle, and should be faster than messing about with the stencil buffer.


1

When cylinder and frustum intersect the hole will be a view into the internals of the cylinder. The hole is where external of the cylinder occlude frustum and internal of the cylinder does not occlude the frustum. Knowing this you should simply do the following to find the surface (or rather volume) made from the hole. Render frustum without color and set ...


Only top voted, non community-wiki answers of a minimum length are eligible