Jump to content
  • Advertisement
Sign in to follow this  
X Abstract X

Matrix Multiplication (Basic Question)

This topic is 3007 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I implemented my own function to multiply matrices but I'm wondering why I have to multiply in reverse order compared to GLSL to achieve the same result?

Share this post


Link to post
Share on other sites
Advertisement
It's probably because different conventions are being used in your code than are being used in the GLSL code.

Matrix 'majorness' may be an issue if you've got your indexing wrong (e.g. within your multiplication function or in the functions that build your matrix transforms). The other likely culprit is differing vector notation conventions (i.e. row vectors vs. column vectors).

A good first step would probably be to make sure you know what matrix layout (row-major or column-major) and vector notation convention (row vectors or column vectors) are being used in your own code, and are being assumed by the GLSL code (so that's four things you need to check in total). If there's a mismatch anywhere, you'll need to adjust accordingly.

Also, if you're not sure your multiplication code is right, you can post it here for us to take a look at (if you're using 1-d indexing, make sure to let us know whether your matrices are row-major or column-major).

Share this post


Link to post
Share on other sites
I would guess that you are using column vectors and the other code uses row vectors or vice-versa. This means that rotation matrices are either pre or post multiply.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!