Skip to content
Calvin Day edited this page Jul 7, 2021 · 1 revision

Matrix is an OpenGL 4x4 Right handed, Column Major style matrix.

Visual description of how data is organized:
m0, m4, m8,  m12
m1, m5, m9,  m13
m2, m6, m10, m14
m3, m7, m11, m15

Constructors

Matrix()

Matrix Projection = new Matrix();

Creates a Matrix with all values set to zero.


Matrix(float m0, float m1 ... float m15)

Matrix Projection = new Matrix(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);

Creates a Matrix with specified values.


Matrix(Float[] floatArray)

Matrix Projection = new Matrix(floatArray[]);

Creates a Matrix with the first 16 elements of an array of floats.

NOTE: This constructor does not check for array length of 16. Passing in an array smaller than 16 floats will cause an IndexOutOfBounds exception!

Methods

Getters and Setters are available for m0 - m15 and follow the convention getM0, setM0, getM1, setM1, etc.


toString()

Projection.toString();

returns a String containing the array data formatted as follows:

m0, m4, m8,  m12
m1, m5, m9,  m13
m2, m6, m10, m14
m3, m7, m11, m15
Clone this wiki locally