Sign in to follow this  
Mithoric

Matrices are my new best friends!

Recommended Posts

I had been avoiding matrices up until now because they looked strange and scary. However after browsing 100+ posts and articles on this site and opengl.org I decided that if I was going to make a camera class I'd probably have to learn matrices to follow any of those tutorials. In my travels over the web I found this website - matrices can be your friends - and I would recommend that anyone who doesn't understand matrices to have a look at it! How about that, I bet you don't see many people actually researching topics by themselves around here do you? [wink] ...

Share this post


Link to post
Share on other sites
eh? what what?

I am building a camera class, I figured there is a lot of talk about quaternions so I may as well use them. Now the quaternion rotation matrix is [3][3] right, so does that mean that those values go into [0][1][2][4][5][6][8][9][10] in the [4][4] ([16]) OpenGL matrix?

Share this post


Link to post
Share on other sites
[00][04][08][12] | [00][01][02][03]
[01][05][09][13] | [04][05][06][07]
[02][06][10][14] | [08][09][10][11]
[03][07][11][15] | [12][13][14][15]

Should be somewhere along the lines of this, depending on whether you're using column-major or row-major matrices.

I use 4x4 in my quaterion class, simply filling the none-used rows/columns with 1s & 0s as appropriate.

[X][X][X][0]
[X][X][X][0]
[X][X][X][0]
[0][0][0][1]

This way all vectors/matrices are 4D and I don't have to switch constantly.

Share this post


Link to post
Share on other sites
Thanks wildfire that's exctly what I was talking about! yay!
I was actually thinking about using a [4][4] in my class but I'm hardly up to the programming yet, I've still a few more articles to read and I've dug up a lot of code to have a look at.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this