#143651 - Noda - Thu Oct 25, 2007 1:08 am
Hello!
I would like to make a rotation on 2 different axis (with different angle for each axis) at the same time, meaning that the rotation on the first axis won't affect the second one, but I don't know how to do that..
My goal is to make a ball rolling, and I'm quite stuck with this rotation issue :/
Thanks.
Last edited by Noda on Sat Nov 03, 2007 6:06 pm; edited 1 time in total
#143667 - sajiimori - Thu Oct 25, 2007 2:24 am
glRotate isn't appropriate for this task. You'll need matrix math. (Quaternions also work, but you can skip them until you have speed problems.)
What you want is for your object to carry a 3x3 matrix, where each row is a local coordinate axis. I'm not sure how much you know about 3D math, but you know how there's the main world XYZ axes? Well, a rotated object has local axes that represent its personal right, up, and forward directions.
The local axes of an unrotated object is the identity matrix -- that is, its "right" is the same as the world's "right", and so on.
Matrix multiplication (concatenation) is how you rotate an object's local axes so the object has a new orientation. I'll leave the question of how to get the other matrix (the one that describes how to rotate) until a later post, to make sure I'm on the right track as far as your questions!
#143669 - Rajveer - Thu Oct 25, 2007 3:20 am
I read the same problem from your post as sajiimori. I'd advise you to look up Gimbal Lock...ok I'll sum it up: instead of rotating an object round it's local axis (as sajiimori said, each object has it's own set of x, y and z axes which get rotated as the object does), you're continuing to rotate around the world's axes. This will lead to rotations in unwanted axes, and is what glRotate does. I also advise you to look up axis-angle rotations and how to represent them as a 3x3 matrix, as they are simpler to understand than quaternions.
#143677 - Noda - Thu Oct 25, 2007 6:36 am
Yes I thought of a matrix transformation, but from what I saw from the libnds source, the glRotate is just that, a simple matrix transformation.
I'm quite bad at maths but I have a good 3D / matrix transformations understanding, so then I would just need to know how to apply a transformation based on the object local axis and not on the world axis, right?
thanks a lots for yours answers!
#143699 - Rajveer - Thu Oct 25, 2007 12:26 pm
To put simply, if you have the matrix of an object (which should be the identity matrix at first and so it is aligned with the world axis), in OpenGL (as it is column-major) you would multiply a rotation matrix after the objects own matrix for a local rotation (so a world rotation would be before the object's matrix, note its the other way round for row-major APIs). So if you want to rotate in the object's x-axis, where O is the objects matrix and R is the rotation matrix for x-axis rotations, then:
O . R = New matrix.
The matrices for multiplying an object in its local x, y and z axis can be found on the internet easily, and along with them so should the method for creating your own rotation matrix based on a specific axis and angle. Good luck!
#143724 - Noda - Thu Oct 25, 2007 5:18 pm
Yes I get that and I know how to make a rotation matrix, but how do you get the object matrix?
I mean in openGl fashion, when drawing an object, transformation are applied to the MODEL_VIEW matrix, right?
#143727 - Rajveer - Thu Oct 25, 2007 6:19 pm
Yep you're right. You would store a 4x4 matrix for each object which would start off as the identity matrix. You'd alter it by dot product with a rotation matrix as you know and edit it's position by changing the right entries within the matrix, then you'd put it onto the modelview matrix.
#143731 - sajiimori - Thu Oct 25, 2007 6:38 pm
BTW, it's true that glRotate applies a rotation matrix, but it always applies a matrix that rotates along a world axis. It's really awkward to assemble an axis/angle rotation by applying a series of rotations along world axes. It can be done, but it involves somewhat convoluted reasoning, and it's inefficient.
Edit: Also, the DS has separate model and view matrices, which is great because you can set the view matrix once for the whole scene, then simply load up each model's matrix and render it. Like Rajveer said, each model should be carrying its own matrix. (They actually only need 4x3, where the 3x3 part is rotation and the last part is position.)
#143936 - Noda - Sat Oct 27, 2007 3:13 pm
:S I'm still quite lost..
If I apply my rotation matrix after the display list of the object has been loaded, nothing happens...
it's like:
Code: |
glPushMatrix();
glTranslate(...); // put the object at the right position
glCallList(..); // load the object (a ball)
/* then apply here rotations using MATRIX_MULT_3x3 = ... ??? */
|
#143983 - Rajveer - Sun Oct 28, 2007 12:08 am
Apply rotations before you use the CallList. It's the same reason why you call Translate before the CallList: because OpenGL works in states and your object will only get affected by a rotation matrix if the matrix is called before. Also, if you can use a 4x4 matrix, or if you can concatenate your final 3x3 rotation matrix aswell as your object's positions into a 4x4 matrix, then I'd use
Code: |
glMultMatrix4x4((m4x4 *)&Object_Matrix); |
to set the object's position and rotation, instead of glTranslate and multiplying by your rotation matrix (seems easier).
(I think that's right, never used display lists before)
#143986 - sajiimori - Sun Oct 28, 2007 12:34 am
Right, drawing is the absolute last step. You can't retroactively rotate things you've already drawn.
I personally wouldn't even bother with glMultMatrix or glPushMatrix, unless you're doing something fancy. I'd just load the object's matrix straight onto the stack and overwrite the previous one. Or do you need the old matrix for something?
Finally, you probably don't need 4x4 matrices. 4x3 is plenty to represent rotation and position.
#143991 - M3d10n - Sun Oct 28, 2007 1:28 am
sajiimori wrote: |
I personally wouldn't even bother with glMultMatrix or glPushMatrix, unless you're doing something fancy. I'd just load the object's matrix straight onto the stack and overwrite the previous one. Or do you need the old matrix for something? |
Huh... wouldn't that override whatever matrix he'd happen to be using to position the camera? Multiplying the camera matrix by every object's matrix by hand and loading the whole stuff later sounds convoluted.
The transform pipeline I'm used to work with goes like this (in modelview):
1- Setup the camera position matrix
2- Push matrix
3- Multiply object's matrix
4- Draw object
5- Pop matrix
6- repeat #2 to #5 for all other objects in the scene
#143992 - Rajveer - Sun Oct 28, 2007 1:49 am
sajiimori wrote: |
Finally, you probably don't need 4x4 matrices. 4x3 is plenty to represent rotation and position. |
Just to elaborate on what sajiimori said, a 4x3 or 4x4 matrix should be the last step: rotations should be stored as 3x3 and the object's location as a separate vector, which is all concatenated to a 4x3 or 4x4 matrix and multiplied against the current matrix as M3d10n said, as during the process of creating the object's final matrix you cannot dot product 4x3 matrices with 4x3 matrices.
#144157 - sajiimori - Mon Oct 29, 2007 7:08 pm
M3d10n, you're right about OpenGL in general, but the DS has a separate camera matrix -- no need for multiplies! :D
About 4x3 matrices, I have objects carry a struct like this, so there's no need for assembling the matrix every frame either:
Code: |
struct Matrix43
{
Matrix33 axes;
Vector3 trans;
};
|
You can upload that straight to the hardware.
#144175 - silent_code - Mon Oct 29, 2007 10:49 pm
i use vec3 positions and rotation quaternions. (sometimes there's also an additional 4x3 world position/orientation matrix around. ;^p )
you can get axis and angles from the quat and rotate with a single call to glRotate. that way i can interpolate orientations quite smoothly (cutscenes, paths ...), if i want. well, if i can spare the extra memory for a matrix, then it's fine to save on some computations, but in general objects tend to turn quite often and the frame to frame coherency is quite low, so the matrix would have to be build anyway. so i can savely let libnds do that for me! (though i could build the matrix directly from the quat by myself.) ;^p
this may be overkill to some, though. i understand that. ;^)
#144188 - Noda - Tue Oct 30, 2007 1:22 am
Hmm I tried first the simple way with 3x3 rotation matrix before optimizing the code, but it doesn't show a single thing :/
Is there anything wrong with this?
Code: |
int32 cosX = cos(xa);
int32 cosY = cos(ya);
int32 cosZ = cos(za);
int32 sinX = sin(xa);
int32 sinY = sin(ya);
int32 sinZ = sin(za);
m3x3 matrot;
matrot.m[0] = cosZ*cosY;
matrot.m[1] = sinZ*cosX - cosZ*sinY*sinX;
matrot.m[2] = sinZ*sinX + cosZ*sinY*cosX;
matrot.m[1] = -sinZ*cosY;
matrot.m[4] = cosZ*cosX + sinZ*sinY*sinX;
matrot.m[5] = cosZ*sinX - sinZ*sinY*cosX;
matrot.m[6] = -sinY;
matrot.m[7] = -cosY*sinX;
matrot.m[8] = cosY*cosX;
glPushMatrix();
glMultMatrix3x3(&matrot);
// call dl of the object here
glPopMatrix(1);
|
#144189 - sajiimori - Tue Oct 30, 2007 1:28 am
Edit: This is in response to silent_code.
glRotate may be a single call, but it isn't implemented in hardware, so watch out for the amount of work done there.
There are basically two primary issues to decide when representing rotation for an object:
1) Should it keep its 3x3 matrix around, or rebuild it from scratch from other data every frame?
2) What other rotation representations will the object carry (in addition to its matrix, or instead of it)?
A lot of factors come into play when deciding these questions. I tend to avoid optimizing for memory though, because the DS can't render very many models anyway. I'd rather destroy some distance-clipped or frustum-culled objects to make the nearby objects render faster.
#144190 - sajiimori - Tue Oct 30, 2007 1:35 am
I can't tell you what's wrong, but I can give you a procedure to try.
Get your object rendering correctly on the origin first, with a good viewing angle, without the new rotation code.
Add controls for moving the object around, as well as the camera.
Then add the new rotation code, but start with zero rotation. The 3x3 matrix should be set to identity: [(1,0,0), (0,1,0), (0,0,1)].
If the object doesn't render correctly, verify that you're using an identity matrix. Print out the contents of the matrix on your console.
After you get it rendering with no rotation, hook up some controls to slowly rotate your object. Then you can see what happens as you increase rotation.
Whenever possible, start with something that works on screen, and use interactive controls to see where it breaks! This is more fun and less frustrating. :)
#144196 - Noda - Tue Oct 30, 2007 2:39 am
Tried with the identity matrix same result... without the glMul... everything works well.
There must be something with my matrix or the way I use glMult..
#144198 - M3d10n - Tue Oct 30, 2007 3:11 am
sajiimori wrote: |
M3d10n, you're right about OpenGL in general, but the DS has a separate camera matrix -- no need for multiplies! :D
About 4x3 matrices, I have objects carry a struct like this, so there's no need for assembling the matrix every frame either:
Code: | struct Matrix43
{
Matrix33 axes;
Vector3 trans;
};
|
You can upload that straight to the hardware. |
Separate camera matrix? Tell me more.
I just load the perspective matrix using GL_PROJECTION and position my camera using GL_MODELVIEW and do the push/multiply/pop for every model. You mean I can just load the model matrices while keeping the camera intact? Is it using GL_POSITION or something? (I never quite got the difference between GL_POSITION and GL_MODELVIEW)
#144212 - Noda - Tue Oct 30, 2007 5:04 am
Humm now I have the matrix working with identity and simple rotation (1 axis), althought I had to reverse the rotation & translations matrix (need to put the translation before the rotation which seems strange for me..).
But when I use the rotation matrix along the 3 axis at the same time (the one above, and I tried another to be sure that the formula is correct), and I get nothing :/ I don't get where's the problem is :(
#144213 - sajiimori - Tue Oct 30, 2007 5:10 am
You know, I think I was wrong to imply that the DS has another matrix beyond what OpenGL has. (I've never written a GL app.)
What I should have said is that I fold the view matrix into the projection matrix, and then copy the model's matrix straight into the position matrix.
Basically, I treat the two matrices as "projectionview and model" rather than "projection and modelview". :D
Last edited by sajiimori on Tue Oct 30, 2007 5:12 am; edited 1 time in total
#144214 - sajiimori - Tue Oct 30, 2007 5:11 am
Noda, you gotta make it interactive to see what's happening. Can't stress that enough! Debugging by "see vs no-see" is a total waste of time. Turn it on a second axis and watch it break in realtime. :)
#144215 - Noda - Tue Oct 30, 2007 5:31 am
I would do if I could, but it's 1 axis at a time (working) vs 3 axis at a time (I don''t how to make 2 at a time??) and it's not working, even with 0? angles.
I'm still digging, but whatever is the value for the angles, nothing show up (and actually i modify the rotation angle with the stylus so it's quite interactive ;))
#144220 - Rajveer - Tue Oct 30, 2007 11:33 am
Does it only work first time in the same axis each time, or any axis? Does it work in the same axes multiple times or only once? Are you normalising the matrix? Are you using fixed-point rather than floating-point?
#144239 - Noda - Tue Oct 30, 2007 5:21 pm
Humm what do you mean by normalizing the matrix?
Yes it works if I multiply many times by the same matrix.
Something strange though, is that it's working fors axis X & Y but not Z (I checked the formula many times!) :/
#144243 - NeX - Tue Oct 30, 2007 6:41 pm
How did you get the trig functions working? They're not recognised here. I have to generate LUTs with Dark Basic.
_________________
Strummer or Drummer?.
Or maybe you would rather play with sand? Sandscape is for you in that case.
#144245 - sajiimori - Tue Oct 30, 2007 7:39 pm
It doesn't work when rotating by zero degrees using the all-axes method? Print out the contents of the resulting matrix to verify that it's identity.
#144248 - Noda - Tue Oct 30, 2007 8:44 pm
NeX wrote: |
How did you get the trig functions working? They're not recognised here. I have to generate LUTs with Dark Basic. |
Taken from a libns example:
Code: |
int32 sin(float angle)
{
int32 s = SIN[(int)((angle * LUT_SIZE) / 360.0) & LUT_MASK];
return (s);
}
int32 cos(float angle)
{
int32 c = COS[(int)((angle * LUT_SIZE) / 360.0) & LUT_MASK];
return (c);
} |
Hmm yeah I'll try to display the rotation matrix with 0 degrees angle to see what's wrong, but the fact that a simple rotation around Z axis bothers me too :s
#144415 - Noda - Thu Nov 01, 2007 8:22 pm
I finally got my rotation matrix to work (needed to replace '*' but mulf32 >_<)!!
But still, it's doing the same thing as glRotate() :'(
Please, can you post the right combination to make the rotation works along the fixed world's axis and not along the object's axis??
What I'm doing now:
1) glPushMatrix()
2) glMultMatrix4x3() (3-axis rotation + translation)
3) call display liste
4) glPopMatrix(1)
Then how can I make the rotation on X axis not affect the one on Z axis?? (unless going through complex quaternion operations...)
#144416 - Rajveer - Thu Nov 01, 2007 8:34 pm
Noda wrote: |
I finally got my rotation matrix to work (needed to replace '*' but mulf32 >_<)!! |
Heh, I did mention fixed point before! :)
The problem seems to be your method of modifying the object's matrix, not rendering the object. Also, I think you're a bit confused, if it's doing the same as glRotate then it's always rotating in the world axes and you want to rotate in the object's local axes, not the other way around. So post your multiplication process here and we'll take a look. Are you sure when you're using the dot-product that the object's matrix is on the left and the rotation matrix is on the right? If you've been reading D3D tutorials then it's the other way around because D3D uses row-major matrices.
#144420 - Noda - Thu Nov 01, 2007 9:03 pm
Hmm i've read againt all the answers trought this post I may be have missed a point: what do you mean by the "object matrix"?
Also I've experimented with something I don't understand:
If before doing my glMultMatrix4x3 I load the identity matrix, then my object goes out of screen, is that normal? I don't get why it's going like this..
Thanks for your help, I think the rotation matrix is the good one this time:
Code: |
matrot.m[0] = mulf32(cosZ, cosY);
matrot.m[3] = mulf32(cosZ, mulf32(sinY, sinX)) - mulf32(sinZ, cosX);
matrot.m[6] = mulf32(sinZ, sinX) + mulf32(cosZ, mulf32(sinY, cosX));
matrot.m[1] = mulf32(sinZ, cosY);
matrot.m[4] = mulf32(cosZ, cosX) + mulf32(sinZ, mulf32(sinY, sinX));
matrot.m[7] = mulf32(sinZ, mulf32(sinY, cosX)) - mulf32(cosZ, sinX);
matrot.m[2] = -sinY;
matrot.m[5] = mulf32(cosY, sinX);
matrot.m[8] = mulf32(cosY, cosX);
matrot.m[9] = x.getRaw();
matrot.m[10] = y.getRaw();
matrot.m[11] = z.getRaw();
|
also, something not related but... does anyone have an idea about my "disco" light problem, I'm really lost with this one (on emulators it's working well...)
#144421 - NeX - Thu Nov 01, 2007 9:04 pm
Are you defining normals?
_________________
Strummer or Drummer?.
Or maybe you would rather play with sand? Sandscape is for you in that case.
#144443 - Noda - Thu Nov 01, 2007 11:34 pm
Yes. But It doen't make any changes at all, as either using a model display list without normals or a model built by hand with normals have the same results... Then I don't get how normals could affect my rotation...
EDIT: oups maybe you were asking for the disco thing :p for my model with normal it's working nicely on ideas but on ds the light goes disco... :/
#144448 - Rajveer - Fri Nov 02, 2007 1:13 am
When I say object matrix I mean that each object that you have onscreen that is to be rotated should have a 3x3 matrix with it to store its current rotation. You rotate an object by modifying this matrix, which is not done directly but is done by dot-producting it with another matrix called a rotation matrix which you create each time a rotation is to be done. At the moment, if matrot is the only matrix that you have, and you are changing variables cosX, sinX e.t.c, then you will only get a world-rotation and not a local rotation as you aren't "remembering" the object's current rotation and modifying that, instead you're creating a new matrix and changing angles.
If you already have a matrix stored for each object then sorry for that long description, I read your post wrong!
#144451 - Noda - Fri Nov 02, 2007 1:40 am
No you're totally right, that's what I missed (also because I did not understood very well what your were telling before..)
Thanks :)
Then that how I understand it, correct me if I'm wrong:
- for my ball object, I need 1 object matrix, which holds the current rotation applied to the ball (initialized with identity, right?)
- then I have the matrix I've posted before, to make the rotation, calculated each frame but not with the absolute angles but relative angles this time (only changes from the last rotation)?
- each frame, to draw my object I need to calculate O' = O * R manually (not using the libns function)
- finally to draw my object I do like this:
glPush...
glMultMatrix3x3(O')
glTranslate..
glCallList..
glPop...
Am I right? (I just need to be sure before wasting another consequent amount of time trying something wrong...)
The thing that I don't get is that is will have the same effect of directly applying R the first time?? (then wrong so..)
Thanks a lot for your help.
#144456 - Rajveer - Fri Nov 02, 2007 2:14 am
Noda wrote: |
- for my ball object, I need 1 object matrix, which holds the current rotation applied to the ball (initialized with identity, right?) |
Yep.
Noda wrote: |
- then I have the matrix I've posted before, to make the rotation, calculated each frame but not with the absolute angles but relative angles this time (only changes from the last rotation)? |
Yep, and yep about the relative angles (note that you would generate a rotation matrix depending on what axis and angle you want to rotate by, or you could have 3 functions/methods, one to rotate in each of the x y and z axis and just change the angle).
Noda wrote: |
- each frame, to draw my object I need to calculate O' = O * R manually (not using the libns function) |
Yep (I'm not too sure about the libnds function, take a look at it and see if you can use it, if not then remember to try and use hardware matrix multiplication! [if i got my facts right])
Noda wrote: |
- finally to draw my object I do like this:
glPush...
glMultMatrix3x3(O')
glTranslate..
glCallList..
glPop... |
Exactly!
Noda wrote: |
The thing that I don't get is that is will have the same effect of directly applying R the first time?? (then wrong so..) |
When you say the first time, do you mean is it the same as loading an identity matrix each time and applying R? Well it depends, if you can calculate the way an object should be rotated each frame then yes. Remember, multiple rotations can be represented as one rotation, so yes you're right. But in real life, you probably can't calculate how an object should be rotated each frame without remembering how the object is rotated at the moment, unless you dont require local rotations and only need to use world rotations. In that case, no its not the same as you would be always applying R without applying it relative to the object's current rotation. By remembering an object's rotation, you're kinda rotating the object in relation to it's current x, y and z axes. Hope that made sense!
EDIT: Ok, hopefully a better explanation. So you're saying why can't you do Rotation = I(dentity) x R right? That's the same as doing Rotation = I x O' when you draw your objects for some O' right? But O' isnt the same as R, and to calculate O' using matrix multiplication you need O as well as R. So you can't just do Rotation = I x R, because its not the same as Rotation = I x O' which works.
Noda wrote: |
Thanks a lot for your help. |
Not a problem :)
#144476 - Noda - Fri Nov 02, 2007 4:54 pm
Finally, I got it working!
For now I'm not using hardware matrix calculation as I don't get how to retrieve the matrix after the multiplication :s
BUT (there's always a "but"...), it works, but as long a my ball is rolling during sometimes in different direction, it's getting slowly deformed (it seems scaling doesn't stay 1/1/1) :(
I think that's due to the fixed point operations which due to rounding errors is causing this effect (as the object matrix save the accumulation of all rotations...). Then how to fix that? Maybe there's a way to "normalize" (don't know if that's the right term) the matrix so the scaling stays 1/1/1?
#144478 - Rajveer - Fri Nov 02, 2007 6:04 pm
Glad you're making progress! Exactly what I had, because of the fixed point inaccuracies eventually the object's matrix will become unnormalised (that a word?). You need to use libnds's normalizef32 function (or whatever its called, its in videoGL I think) on each of the x, y and z axes in the objects matrix (I did this every frame). You do have to choose which axis to normalise first, but if each axis is as important as each other then choose any axis first.
#144485 - sajiimori - Fri Nov 02, 2007 8:05 pm
The matrix will also lose its orthogonality over time. That is, even if you ensure that the axes are unit length, that doesn't mean they're at 90 degrees to each other.
Renormalizing a rotation matrix involves more than just normalizing the vectors individually. First you should do a cross product between the first two axes and store that as the 3rd axis, then cross the first and third axis to get the second. Then you should normalize each axis.
This is one thing that makes quaternions more appealing at times, but you can usually stagger the renormalization of matrices so you don't have to update all of them on every frame. Noticable errors don't typically appear until after several frames.
#144488 - Noda - Fri Nov 02, 2007 10:11 pm
Ok, I get that.
Do you have an example or some sources on how to do what you said? (calculating the 3rd axis based on the 2 first then normalizing?)
I could have considered quaternions if I wasn't that bad with maths...
#144494 - tepples - Fri Nov 02, 2007 10:50 pm
If you take the cross product of two rows of the rotation matrix, do you get anything that looks like the third?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#144495 - sajiimori - Sat Nov 03, 2007 12:20 am
Code: |
void Matrix33::orthogonalize()
{
y = z.cross(x).normalized();
x.normalize();
z = x.cross(y);
} |
#144520 - M3d10n - Sat Nov 03, 2007 4:30 am
sajiimori wrote: |
You know, I think I was wrong to imply that the DS has another matrix beyond what OpenGL has. (I've never written a GL app.)
What I should have said is that I fold the view matrix into the projection matrix, and then copy the model's matrix straight into the position matrix.
Basically, I treat the two matrices as "projectionview and model" rather than "projection and modelview". :D |
Ah, rotating/translating the projection matrix. I avoid that in OpenGL after some annoying bug with fog: I had the projection matrix itself rotated to use 3DS MAX-style Z-up coordinates once, but the per-pixel fog in OpenGL seems to always use the projected Y coordinates as depth, so I had an accidental and unwanted volumetric floor fog by result.
GBATEK mentions that the only thing which gets borked when the projection matrix is rotated is the environment reflection, so you should be safe.
#144544 - Noda - Sat Nov 03, 2007 6:06 pm
Thanks everyone, now everything is working nicely, and I've greatly improved my 3D understanding/openGL/matrix math skills ^^
#144550 - silent_code - Sat Nov 03, 2007 7:14 pm
<IGNORE ME>... and finally you got the same result as using quaternions. ;^P</IGNORE ME>
good to see you finally made it working! it will surely help some others, because these problem occure often, especially in the beginning of lerning.
maybe you could write a mini tutorial about it in the beginners section?
btw.: there should be a mini tutorial / snippets section in this forum, so one doen't have to search the whole forum for some example code that someone might have posted *decades* ;^p ago.
#144551 - Noda - Sat Nov 03, 2007 7:20 pm
I'm totally agree with you, concerning the mini-tutorial section, as there's plenty of information in this forum, but it's hard to find an already found solution by gathering all the posts that made to it :/
So then, give me a little time and I'll make my tutorial ;) (it might be and addition to the rules: once a solution to your problem is found, make a small resume/tutorial on how it was solved?)
EDIT: just a note? do you have an idea why my glTranslate call has to be before the glMult3x3 one (that rotate the matrix)? I've always been told that it must have been the opposite (rotation first, then translation)?
#144553 - silent_code - Sat Nov 03, 2007 7:33 pm
the only thing i can guess right now (i don't have access to anything nds relate right now) is, that glMult3x3 does something funny, that overwrites the translation... i really can't tell.
i also find that weird, because a translation before a rotation translates the objects point of rotation... if you don't save your translation in a way that needs an inverse translation to restore the p-o-r, that is.
i guess that's worth another mini tutoiral. ;^D
#144556 - Noda - Sat Nov 03, 2007 8:41 pm
The really weird thing is that when my translation is after the glMult3x3, the point of rotation is changed :s