Umm, it sounds like you’re trying to rotate around two distinct and completely different coordinate systems.
Now, try to explain better:
Are you trying to rotate the cube around it’s center of gravity (so it spins), or are you trying to rotate the cube around the world’s center (so it rotates in an orbit)?
If you’re trying to do the former, you do what was said above by Korval. If you’re trying to do the latter, you leave out the glTranslate call.
Now, if I understand you right, it seems like you want to “spin” the cube about its center of gravity on an axis parallel to a given axis in the world. If this is the case, you do what Korval said above, substituting in the world’s axis for the rotation axis.
Those are the three possible things I can glean from what you are trying to say. I don’t know which one you mean exactly, so I hope I’ve covered all the cases. If not, please be more detailed.
Oh, this is a Euler-axis rotation problem. I think you’ll need to generate your rotations via quaternions. I don’t know much about them yet, but I’m pretty sure you can find all the information you need here if you do a search on quaternions.
Maybe it’s a stupid question… but I’ll ask it anyway
Do you know that 3DStudioMAX and OpenGL uses different coordinate systems? the first is right-handed, with Z pointing backwards (out of the monitor)… well, maybe this is very basic stuff and you already know that, but it seems that in your page (the last 2 pictures) ‘your own’ box is rotating around the X axis… when the 3DS’s box do that in Z…
I hope this helps.
Royconejo.
[This message has been edited by royconejo (edited 03-24-2001).]
I tried to use Quaternion as some of you told me. I pick up some fonction on GameDev to help me doing so.
First, i convert my Euler to a Quaternion.
Second, i convert my Quaternion, to a Matrix.
Tirth, i load this Matrix in OpenGL to make my transformation.
But no luck i guess. Whan am i doing wrong? it seems that no one really know how to do that kind of rotation like this one: http://www.orbzyx.com/rotproblem.htm