# Thread: defining and manipulating 4x4 matrices

1. ## defining and manipulating 4x4 matrices

I would like to multiply a matrix by some rotation and translation matrices. Can someone please give me an example of how to define a 4x4 matrix? DO we enter it row by row or column by column?

Can i vector multiply by (*)?

Many thanks!!

2. ## Re: defining and manipulating 4x4 matrices

From the OpenGL FAQ:
http://www.opengl.org/resources/faq/...formations.htm

[qoute]
9.005 Are OpenGL matrices column-major or row-major?

For programming purposes, OpenGL matrices are 16-value arrays with base vectors laid out contiguously in memory. The translation components occupy the 13th, 14th, and 15th elements of the 16-element matrix.

Column-major versus row-major is purely a notational convention. Note that post-multiplying with column-major matrices produces the same result as pre-multiplying with row-major matrices. The OpenGL Specification and the OpenGL Reference Manual both use column-major notation. You can use any notation, as long as it's clearly stated.

Sadly, the use of column-major format in the spec and blue book has resulted in endless confusion in the OpenGL programming community. Column-major notation suggests that matrices are not laid out in memory as a programmer would expect.

[/QUOTE]

3. ## Re: defining and manipulating 4x4 matrices

P.S. you'll only be able to vector multiply if you have a class that has implemented a method to do su. There is no C or C++ code for matrix support in OpenGL, it's just a brainless array of floats.

OpenGl will perform appropriate vector multiplies during the transformation process but that is an automatic internal detail.

4. ## Re: defining and manipulating 4x4 matrices

I got it! All thanks to your help, dorbie.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•