I just can’t understand why the gl_ClipDistance doesn’t work. The result is the same as I didn’t set the gl_ClipDistance.
I had set "glEnable(GL_CLIP_DISTANCE0);glEnable(GL_CLIP_DISTANCE1); " by application.
the vertex shader is like this:
#version 410
uniform mat4 mvpMatrix;
//.......some other uniforms here
in vec2 vVertex;
uniform vec4 clip_plane=vec4(1.0,1.0,0.0,0.85);
uniform vec4 clip_sphere=vec4(0.0,0.0,0.0,10.0);
void main(void)
{
//........some other code,include vec2 worldPos
vec4 worldPosition=vec4(worldPos.x,height,worldPos.y,1.0);
gl_ClipDistance[0]=dot(worldPosition,clip_plane);
gl_ClipDistance[1]=length(worldPosition.xyz/worldPosition.w-clip_sphere.xyz)-clip_sphere.w;
gl_Position = mvpMatrix * position;
}
anyone can help me figure it out?