Matrix multiplication order

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Valmond
Posts: 308
Joined: Thu Apr 12, 2007 3:26 pm

Matrix multiplication order

Post by Valmond »

Hi all!

I'm trying to convert some DirectX code to 'Irrlich-DirectX' code and it seems the matrix multiplications are 'the other way' in them.

In the M$ example it says:

Code: Select all

Matrix mViewProj = m_mView * m_mProj;
but in Irrlicht I do: (starting with Projection and multiplies with View to get, not proj_view but view_proj...)

Code: Select all

core::matrix4 ViewProj ;
ViewProj = driver->getTransform(video::ETS_PROJECTION);
ViewProj *= driver->getTransform(video::ETS_VIEW);
 
Why is it so, is the multiplication code reversed in Irrlicht (or am I dreaming)?
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: Matrix multiplication order

Post by Radikalizm »

I believe DX stores matrices in column-major format while irrlicht stores them in row-major format
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Matrix multiplication order

Post by hybrid »

IIRC, the *= operator uses different order. Just do it as the others do.
Post Reply