New Paste :: Recent Pastes:: No Line Numbers
Converts a 4x4 C style matrix to OpenGL style. by davean
1
void toOGLMatrix() { float tmp; // 0 stays in 0 // 5 stays in 5 //10 stays in 10 //15 stays in 15 //1 and 4 switch tmp = mat[ 1]; mat[ 1] = mat[ 4]; mat[ 4] = tmp; //2 and 8 switch tmp = mat[ 2]; mat[ 2] = mat[ 8]; mat[ 8] = tmp; //3 and 12 switch tmp = mat[ 3]; mat[ 3] = mat[12]; mat[12] = tmp; //6 and 9 switch tmp = mat[ 6]; mat[ 6] = mat[ 9]; mat[ 9] = tmp; //7 and 13 switch tmp = mat[ 7]; mat[ 7] = mat[13]; mat[13] = tmp; //11 and 14 switch tmp = mat[11]; mat[11] = mat[14]; mat[14] = tmp; //we now are OGL style! }