Jump to content
  • Advertisement
Sign in to follow this  
Phong

OpenGL Hard choice

This topic is 3921 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

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
Share on other sites
Quote:
Original post by Phong
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?

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 this post


Link to post
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 this post


Link to post
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

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!