PDA

View Full Version : GL_CLIP_PLANE



nrbrasiliense
02-11-2003, 11:03 AM
I made a 3D scene and enabled the six opengl's clip planes by calling:
glEnable(GL_CLIP_PLANE0);
...
glEnable(GL_CLIP_PLANE5);

I put a interface to the user interact and clip the scene. It was right, works perfectly.
When you "clip" the scene, its center move away (the direction it moves depends on the clip plane you are moving).
So, I would like to know how could I keep translating my scene based on its center (the up-to-date center), I mean, when you move a clip plane you "reduce" the scene and a new center should be found to rotate based on this new center.
Someone can help me ?!
Thanx a lot,

Rogerio

JustHanging
02-11-2003, 11:15 AM
Rotating around a pivot point (pivot specified in object coordinates):

glTranslatef(pivot[0], pivot[1], pivot[2]);
glRotatef(...);
glTranslatef(-pivot[0], -pivot[1], -pivot[2]);

I hope that helps.

-Ilkka

nrbrasiliense
02-11-2003, 11:21 AM
Dear Ilkka, thanxs for you anwers, by I thing that is not right, because when you rotate the axys you can not simply translate back to that pivot point, if you do that the system cordinates origin will not be at the same place it was before the operation, that means the scene will be drawn in some place you do not want...
Do you agree ?!

JustHanging
02-11-2003, 11:33 AM
I think it's correct, but I agree it doesn't look that way. But that's just the local coordinate system, some things are weird with it. That code comes from a working program (with some modifications), so it really should work. Try it http://www.opengl.org/discussion_boards/ubb/smile.gif

-Ilkka