glMultiMatrix - Rotation/Translation alternative?

Started by
0 comments, last by SFA 19 years, 11 months ago
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 (www.ogre3d.org). 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 to...so 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.
http://www.voodoo-magic.co.uk
Advertisement
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.
"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)

http://www.silvermace.com/ -- My personal website

This topic is closed to new replies.

Advertisement