In Shading Language, the vertex shader can write to a built-in varying gl_ClipVertex, the distance between the vertex and the user-clipping plane.
According to ARB_vertex_program (ARB Extension #26), user clipping planes are not supported in standard vertex program.
(20) How should user-defined clipping be supported in this specification?
RESOLVED: User-defined clipping is not supported in standard vertex program mode. User-defined clipping support will be provided for programs that use the “position invariant” option, where all vertex transformation operations are performed by the fixed-function pipeline.
But I can successfully compile a vertex shader written in OpenGL shading language. Which ouput is bound to gl_ClipVertex? (I don’t know how to compile a high-level code to vertex program assembly.)
CODE LISTING
<test.vert>
void main(void)
{
vec4 a = gl_Vertex;
a.x = a.x * 0.5;
a.y = a.y * 0.5;
gl_Position = gl_ModelViewProjectionMatrix * a;
gl_ClipVertex = 1.0;
}