It is said that OpenGL uses column-major 4x4 matrices (http://www.songho.ca.../gl_matrix.html). Does this mean that the translations are at the right or at the bottom like in Xna?
Opengl: Column-major matrix
Row-major matrixThanks
Posted 29 September 2012 - 07:33 PM
Opengl: Column-major matrix
Row-major matrixPosted 29 September 2012 - 11:32 PM
Posted 30 September 2012 - 03:44 AM
Posted 30 September 2012 - 04:53 AM
You can put the translation along the last row or column, depending on your conventions. Note the distinction between row/column majorness and row/column vectors. Dx and GL's matrix uploading functions expect the matrices to be stored in a given majorness so as long as you comply, you can use any combination of row/column vectors stored in row/column major (although both APIs will transpose your matrices for you if you specify it, at least GL does to my knowledge).
Posted 30 September 2012 - 06:20 PM
translations are at m12,13,14
i just checked
you can pass them with glUniform* with false in the transpose parameter
btw. if you want to make your own little matrix lib, i heartily recommend it
lots of little mini-functions in the class that can do alot less flops than constantly multiplying entire matrices together
eg. translateXZ, translateXYZ, and so on.
Posted 30 September 2012 - 06:27 PM
// left vector m_Element[0] = cy; m_Element[1] = sx * sy; m_Element[2] = -cx * sy; m_element[3] = 0.0f; // w1 // up vector m_Element[4] = 0.0f; m_Element[5] = cx; m_Element[6] = sx; m_element[7] = 0.0f; // w2 // forward vector m_Element[ 8] = sy; m_Element[ 9] = -sx * cy; m_Element[10] = cx * cy; m_element[11] = 0.0f; // w3 // translation m_element[12] = 0.0f; // tx m_element[13] = 0.0f; // ty m_element[14] = 0.0f; // tz m_element[15] = 1.0f; // w4
Edited by Kaptein, 30 September 2012 - 06:33 PM.