visualizing user clip planes?

is there a way to visualize the clip planes sent to opengl? i had reflections working perfectly, but now, after i’ve re-organized my shaders, the user clip planes don’t work correctly anymore.

it doesn’t seem to be possible to query the planes using glGet(), but what i actually need are the transformed, post-vs, planes anyway.

any ideas? it’s hard to debug like this :frowning: thanks.

If you just want to see them, how about just rendering some translucent quads?

yeah but that’s not very helpful :frowning:

this is what i have in my vs:

gl_ClipVertex = gl_ModelViewMatrix*gl_Vertex;
gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;

is this the correct setup?
as i said it used to work fine, but now the clip planes seem to depend on the orientation of the camera.

this video shows what i looked like:

i compute a reflection matrix from from the plane equation given by the mirror’s normal (= abc) and the dot product of this normal and the mirror’s center (= d). i then multiply this matrix with the current view matrix. finally, i pass the plane equation to glClipPlane and render.

It depends on what space your clip planes are in. Keep in mind that the clip planes are automatically transformed to eye-space when you specify them, so what your modelview matrix is at that point matters. I think the most straight-forward approach is to use clip-space planes, then you can simply do gl_ClipVertex = gl_Position.

yeah that was the problem! i didn’t know that the clip planes are transformed by the view matrix, so it was just luck that the correct matrix was present when i set the planes :slight_smile: thanks!