PDA

View Full Version : Transforming glClipPlane



MButchers
09-26-2001, 11:38 PM
hi there,

im having problems with glClipPlane.
I can set up the plane no problem but
i cant seem to transform it currently
im doing -

glEnable(GL_CLIP_PLANE0);
glPushMatrix;
glTranslate(Position.x,Position.y,Position.z);
glClipPlane(GL_CLIP_PLANE0,@PlaneEqn);
glPopMatrix;

ive tried switching the glClipPlane and
glTranslate but with no success.

Thanks

Mark

MButchers
09-27-2001, 11:13 PM
Nobody??

Bob
09-27-2001, 11:57 PM
I don't think clip planes are affected by any matrix operations.

T2k
09-28-2001, 12:08 AM
if BOB is right, then you have to define the clipplane in a box of dimensions: x,y,z= -1 to 1, and you look along z-axis i think from 1 to -1 ...

MButchers
09-28-2001, 12:38 AM
cheers for the ideas,

BOB , in the red book where it explains
glClipPlane it sugests trying transformation
functions and changing the plane coeficients.
So i assume from this it can be done.

I also used to use clip planes for rendering
my GUI to limit the area rendered into before
I used glScissor.(cant remember how i did it
but im sure it was as above)

Besides whats the point of having user defined
clip planes if they cant be moved!!

Cheers

Mark

[This message has been edited by MButchers (edited 09-28-2001).]

Bob
09-28-2001, 01:37 AM
Just read throught the Red Book on clipping planes, and it seems like they are affected by the modelview matrix, so I was wrong on that one.

If you say that your glTranslatef does not affect the clipping plane, the only thing that I can think of is that you are translating the projection matrix.

MButchers
09-28-2001, 02:38 AM
hi there,

I dont think I am because I used to
have a call in there to glScale(1,-1,1) to
flip the geometry and this worked.

I will check tonight ( dont have code on
me! )

Cheers

Mark

MButchers
09-28-2001, 09:45 AM
Its not using glMatrixMode(GL_PROJECTION)
during this call!

Any other ideas anyone?

Thanks

Mark

john
09-29-2001, 02:01 AM
WEll, you could try transforming the plane yourself?

DFrey
09-29-2001, 07:57 AM
Its not using glMatrixMode(GL_PROJECTION)
during this call!
Your answer doesn't convince me you are certain the modelview matrix is current when the function is called. Did you try putting a glMatrixMode(GL_MODELVIEW) before that glPushMatrix?