Weirdness with glClipPlane

I've used glClipPlane before and it always did what it's supposed to do. It made a clipping plane in the modelview space which was static relative to the scene.

But, for some baffling reason I'm seeing a dynamic clip plane which slides around relative to the camera position! It's driving me batty, and I'm hoping some kind soul here can give some suggestions to help me out.

First, a video of what I'm talking about. I'm doing simple reflections, and in the video you'll see a scene of a bunch of textured boxes reflected in a textured plane. I'm rendering world flipped across the plane and using a glClipPlane to clip the scene by that reflection plane.

The relevant code is below. It's a little ugly right now since I'm experimenting. That being said, the reflected rendering and reflected frustum culling work great. The issue at hand is that the clipping plane slides around as the camera moves and looks around. I have no idea why this would happen!

This has happened to me before. I haven't looked at your code in detail but I'm looking at p. 140 of the red book, 3rd ed. which says (italics are mine):

Quote:All points with eye coordinates (xe, ye, ze, we) that satisfy (A B C D) M^-1 (xe ye ze we)^T >= 0 lie in the half-space defined by the plane, where M is the current modelview matrix at the time glClipPlane() is called.

The last time I had this problem, it was because I defined a clip plane before I had placed my camera where I wanted it (essentially putting the clip plane and the camera in different coordinate systems).

It seems that writing to gl_ClipVertex forces software vertex execution ( on the x1600 at least ). What a shame. I pretty much have to give up on rendering reflections if it's going to cause horrible slowdowns.

I've considered that, but the trouble is I'm rendering the entire "world" reflected across the plane, which means all my shaders would have to have the discard code, which wouldn't be used 99.99% of the time.