PDA

View Full Version : glClipPlane() yes, but is there such a thing as glClipSphere() ?



denisdalpe
12-27-2013, 08:02 PM
Using identical Bézier patches (hyperbolic paraboloids) with 12 distinct orientations, I have constructed a continuous three-dimensional surface. It is symmetrical outwards from a central point. I can take sections of the object using clipping planes, but I need to examine the structure by cutting away everything exterior to a given sphere. In other words, I would like to examine its appearance interior to and bounded by a sphere.

Hence my question, is there such a thing in OpenGL as glClipSphere() similar to glClipPlane(), or is there a way to achieve the same end? Of course, I could specify hundreds of tangential clipping planes to a given sphere but there's got to be an easier way.

Aleksandar
12-28-2013, 03:16 AM
No, there is no glClipSphere() or anything similar. But, you can make a very precise cut using vertex shader and clipping on per vertex basis. Not just a sphere, you can implement whatever you want.

mbentrup
12-28-2013, 01:25 PM
Clipping a triangle by a sphere will not give you another triangle (or two) as clipping it with a plane does. You could instead use a fragment shader to discard all fragments outside the clipping sphere.

denisdalpe
01-03-2014, 11:24 AM
Thank you, I'll try that.