I have a geometry shader and I’m attempting to output gl_ClipDistance
from my shader. I’m attempting to pass gl_ClipDistance
that was set from the vertex shader. The code goes something like this:
layout(lines) in;
layout(triangle_strip, max_vertices = 4) out;
...
void passThroughForEmittedVertex(int inPoint)
{
for (int i=0; i < 6; i++)
gl_ClipDistance[i] = gl_in[inPoint].gl_ClipDistance[i];
}
void main() {
...
// generate the triangle strip
gl_Position = vec4( p0.xy + widthToAdd, p0.z, 1.0 )*w0;
passThroughForEmittedVertex(0);
EmitVertex();
gl_Position = vec4( p0.xy - widthToAdd, p0.z, 1.0 )*w0;
passThroughForEmittedVertex(0);
EmitVertex();
gl_Position = vec4( p1.xy + widthToAdd, p1.z, 1.0 )*w1;
passThroughForEmittedVertex(1);
EmitVertex();
gl_Position = vec4( p1.xy - widthToAdd, p1.z, 1.0 )*w1;
passThroughForEmittedVertex(1);
EmitVertex();
EndPrimitive();
}
The clipping functionality works well on Windows, but when tested on Mac, it’s almost as if the gl_ClipDistance
parameters don’t get propagated correctly from the vertex shader.
Does anyone have any ideas of what I can check particularly on Mac that can help me here?
- I’m currently using OpenGL 3.3 core, with no compatibility
- I’m using GLSL 1.5
Thanks for any help you can provide in advance.