Jump to content
  • Advertisement
Sign in to follow this  
amtri

clipping plane with shader

This topic is 2063 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!