Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

row major vs column major and multiply direction

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 greenzone   Members   

678
Like
0Likes
Like

Posted 18 May 2013 - 12:42 PM

When I am using matrices in my opengl program I have been doing multiples left to right.

 

so say M is my original matrix. if i want to apply a rotation to M i would multiple the rotation matrix R to M in this fation

 

 Mrotated =M*R

 

does it mater whether I am using a row major system vs column major system when it come to the direction of my multiply? meaning

 

this, applying a rotation to M:      M*R

 

versus

 

this, applying a rotation to M:      R*M

 

 

or are these two separate issues?


J-GREEN

Greenpanoply

#2 Zaoshi Kaba   Members   

8290
Like
2Likes
Like

Posted 18 May 2013 - 01:13 PM

It does matter. If you transpose row major matrix you get column major matrix and multiplication order becomes reversed.



#3 Glass_Knife   Moderators   

8624
Like
5Likes
Like

Posted 18 May 2013 - 03:44 PM

*
POPULAR

http://www.scratchapixel.com/lessons/3d-basic-lessons/lesson-4-geometry/conventions-again-row-major-vs-column-major-vector/

 

The above article will explain it better than I can!

 

Enjoy.


I think, therefore I am. I think? - "George Carlin"
My Website: Indie Game Programming

My Twitter: https://twitter.com/indieprogram

My Book: http://amzn.com/1305076532


#4 Hodgman   Moderators   

50614
Like
6Likes
Like

Posted 19 May 2013 - 11:53 PM

*
POPULAR

Row major storage vs column major storage makes absolutely no difference on your maths. The meaning A*B is strictly defined according to mathematical rules. The way that matrices are stored in memory is just an invisible implementation detail.

 

What does matter though is whether you treat your vectors (vec4, float4, etc) as row-vectors or column-vectors, i.e. is a vec4 a mat1x4 or a mat4x1?

If you write vec * mat, that's the same as mat1x4 * mat4x4.

If you write mat * vec, that's the same as mat4x4 * mat4x1.

These have different mathematical meanings.

Depending on which one of these conventions you use (which is an entirely different issue from column/row-major storage), you will store your values differently inside your matrices.


Edited by Hodgman, 19 May 2013 - 11:54 PM.





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.