This topic is now archived and is closed to further replies.


glMultiMatrix - Rotation/Translation alternative?

Recommended Posts

SFA    122
Hi. I''m currently in the process of porting my insect based crowd simulation from a standard OpenGL drawing function which I wrote to the Ogre Graphical Engine ( Now in the current implementation, I simply give OpenGL a matrix which looks like this :
 forward.x forward.y forward.z    0
    side.x     side.y     side.z  0
      up.x       up.y       up.z  0
position.x position.y position.z  1

(or whatever) So each insect ''agent'' updates its forward, side, up and position each frame using Euler Ingeration. Now Ogre (AFAIK) doesn''t have an equivilent function I can pass the orientation matrix I need to do it manually... Can anyone tell me / put me on the right track as to how I would do this? I imagine it can be done with rotations/translations... Cheers, SFA.

Share this post

Link to post
Share on other sites
silvermace    634
i think you are doing you matrix math wrong..
you have do each transformation on an Identity matrix then
multipy to get your final transform mat.

this is from memory so,

Translation Matrix:

| 1 0 0 x |
A = | 0 1 0 y |
| 0 0 1 z |
| 0 0 0 1 |

Rotation Matrix (Rotation about Y of angle ''Q''):

| cos Q 0 sin Q 0 |
B = | 0 1 0 0 |
| -sin Q 0 cos Q 0 |
| 0 0 0 1 |

your final matrix you pass to Ogre will just be
[ A times B ]

hope that helps.

Share this post

Link to post
Share on other sites