Advertisement

Axes and rotations

Started by June 23, 2003 06:52 AM
8 comments, last by encom 21 years, 8 months ago
Hi, I must rotate objects, how to keep a static axes (OXYZ) ? Because, when i use glRotate, it rotate the axes, not only the object ? I want to rotate object without rotate the axes ! thanx
// Draw the axesglPushMatrix();{ glRotated(angle, x, y, z); // Draw the object}glPopMatrix();


---
K-1 Productions: Come visit us here.

[edited by - K-1 on June 23, 2003 8:02:01 AM]
---K-1 Productions: Come visit us here.
Advertisement
Hmmmm, yes, of course, but it''s not exaclty my problem !

if i do :

glRotated(90, 1, 0, 0); // rotation on the main axes X
glRotated(90, 0, 1, 0); // rotation on the rotated axes Y

y
|
|____x
/
/
z

after rotation :

y
z /
| /
|/____x


after second rotation :


y
/
/
/____z
|
|
x


The first rotation interact on the second rotation. I dont know how to add two rotation for one object without modificating the axes position.

glPushMatrix();
glRotated(90, 1, 0, 0); // rotation on the main axes X
glPopMatrix();
glPushMatrix();
glRotated(90, 0, 1, 0); // rotation on the rotated axes Y
glPopMatrix();



With just those two rotations the second set of pushing and poping matrix isn''t really needed but its a good practice to push and pop any momvement that you want independent.
Hmmmm

I dont want these rotations independant !!!!!!!!!!

I just want to affect Two rotations on ONE Object !
But these TWO Rotations must be done from static coordinates system.


So push pop poppusp pop doesnt work.

Both rotations will effect the one object, with respect to a non modified axis.

Ether you havnt tried it or I dont understand what you triing to do.
Advertisement
y
/
/
/____z
|
|
x

This is perfectly rigth ! It can''t be another way.
Your problem is due to the fact that you perform the 2 rotations in the same coordinate system.

What you have to do is to perform your second rotation in the coordinate system after the first rotation.
You''d better use matrix : store your 2 rotations in 2 matrix :
rot1 -> mat1
rot2 -> mat2

mat1*mat2 -> mat3 (gives you the rotation in the second coordinate system)

then M2 = M * mat1 * mat3

with M, your source point and M2 the final point
Ok, thanks, but i cant perform this matrix multiplication on a 5000Points object!

Do you have a solution, using openGL functions ?
I have tried this solution :
Pushrotation
Pop
Push
rotation
Pop

I DOESNT WORK, of course ! Nothing turns .....

quote:
Original post by encom
Ok, thanks, but i cant perform this matrix multiplication on a 5000Points object!

Do you have a solution, using openGL functions ?



But you dont have to do it for all of your points ! Just make it once at your object rendering beginning at that''s all

This topic is closed to new replies.

Advertisement