vertex program + clipping ???


I need to have additional clipping planes in my application. I do certain vertex transformations in a vertex program (ARB). I read in the spec that user defined clip planes can be found in ‘state.clip[n].plane’ for GL_CLIP_PLANEn. But how can I peform clippling against that plane then? I read issue 20 of the spec. But somehow I still don’t quite understand how to do it now. Does anyone know something about that?


You can’t. Vertex programs neither create nor destroy vertices, and topological information is not available.

You might want to check out NV version 2.0 vertex programs. They allow you to calculate arbitrary user clipping plane signed distances per vertex. The drawback is that they only work on NV30+ hardware – ATI does not support it.

You can “easily” fake clipping planes by either forwarding a clipping distance and using KIL in the fragment program, or, if you don’t have a fragment program, forward a texture coordinate which maps to a transparent or opaque texel with NEAREST filtering, and use alpha testing.

Thanks for the reply guys. I’m gonna check it out.