clipping plane with shader

Started by
-1 comments, last by amtri 10 years, 1 month ago

Hello,

I have clipping planes working in my shader using gl_ClipDistance. I pass the equation of every clipping plane to my vertex shader and compute the dot product with my untransformed coordinates. It works fine.

Now I ran into a machine where the call

glGetString (GL_SHADING_LANGUAGE_VERSION)

returns 130. Yet, gl_ClipDistance is an undefined variable. This brings up my first question:

1) Shouldn't gl_ClipDistance always be defined for GLSL version 130? I'm using a Linux 64-bit machine with glew 1.10.0.

But I want to get this working, so I decided to alternatively use gl_ClipVertex instead on that machine. The problem is I'm getting no image - kind of like everything is always being clipped out. Given that my glClipPlane is setting the plane equation in untransformed coordinates (i.e., same as gl_Vertex), I'm simply setting gl_ClipVertex = gl_Vertex.

In my gl_ClipDistance implementation I'm taking the dot product of gl_Vertex with the 4 numbers that define the equation in glClipPlane. It works fine. But somehow I think my clipping plane equations are not being properly passed down. I even tried setting "#version 120" in the shader, but with no effect.

Can anybody shed some light onto this?

Thanks.

This topic is closed to new replies.

Advertisement