# OpenGL Hard choice

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

## Recommended Posts

Hallo. I have hard choice, help me to make it. There are two ways to write down matrix transformations: as row vector (1) and as column vector: (1) (x, y, z, w) (2) ( x ) ( y ) ( z ) ( w ) Tre transormation matrices in this two cases is transposed in respect to each other. In all books, concerning 3D math I see second variant. But in OpenGL you write matrix in memory according to type 1. I want to write 3D/OpenGL articles and thinking about matrix transformation notation. Which version is better up to you?

##### Share on other sites
I would stick with the version that the API that you are dealing with uses.

##### Share on other sites
I do agree with you. But from the point of 3D math,

p * A

looks not great, because we used to apply functions and linear operators like this:

A(p) = A * p

Won't it be a confusion for novices?

##### Share on other sites
Quote:
 Original post by PhongHallo. I have hard choice, help me to make it. There are two ways to write down matrix transformations: as row vector (1) and as column vector:(1) (x, y, z, w)(2) ( x ) ( y ) ( z ) ( w )Tre transormation matrices in this two cases is transposed in respect to each other. In all books, concerning 3D math I see second variant. But in OpenGL you write matrix in memory according to type 1. I want to write 3D/OpenGL articles and thinking about matrix transformation notation. Which version is better up to you?

You can use column vector notation (, in your case option (2)) with OpenGL. You will need a custom written matrix library that operates on column vector matrices. Just make sure you use the library functions instead of OpenGL functions to do all matrix transforms.

Column and Row vector notations are notional conventions. Ideally you should mention which convention is used in your 3D application. I however agree that option (2) is easier to grasp for someone learning 3D math. Vice-versa, for someone learning OpenGL this could be just as confusing. So the choice is up to you really. Your decision would very much depend on what audience your articles want to target.

##### Share on other sites
Quote:
 Your decision would very much depend on what audience your articles want to target.

Actually the problem is that my articles topic are: 3D math with OpenGL examples :-)

##### Share on other sites
You shouldn't consider your the matrix/vector operation with row vector. Instead, always use column vector notation. And, you can consider OpenGL using column vector notation too.

Let's put it the other way around. Column vector or row vector are only dummy notation. The only issue that matter is how you interprete the contiguous memory block. In OpenGL, contiguous memory block is considered to be column (or we say it is column major). And, column vector notation naturally follows. Column major is something naturally for people doing numerical analysis which favouring the access of each column.

The reason of your confusion is very likely originated from the fact nearly all image formats consider a contiguous memory block as a row of image. Without proper guidelines, people usually consider a contiguous memory block of OpenGL as a row of matrix. Consequencely, we need a row vector with post-multiply matrix operation to make everything in OpenGL make sense. Eventually, the mathematics notation of OpenGL become a mess.

And, whether your have a column major library or a row major library, you can always present your matrix/vector operation using column vector notation.

For more details about row/column major issuse, you can read the article

http://en.wikipedia.org/wiki/Row-major_order

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5
JoeJ
19

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632998
• Total Posts
3009808
• ### Who's Online (See full list)

There are no registered users currently online

×