AnsweredAssumed Answered

why the gl_ClipDistance[] doesn't work?

Question asked by yan_qingsong on Jun 21, 2014
Latest reply on Aug 1, 2014 by ionutcava

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_Position = mvpMatrix * position;



I tried to only set "glEnable(GL_CLIP_DISTANCE0)"and"gl_ClipDistance[0]=-1.0" ,but what make me confused is that my model just still stay there,didn't disappear.


Anybody know how this happen?