Jump to content
Posted 29 September 2012 - 07:33 PM
Posted 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 = cy; m_Element = sx * sy; m_Element = -cx * sy; m_element = 0.0f; // w1 // up vector m_Element = 0.0f; m_Element = cx; m_Element = sx; m_element = 0.0f; // w2 // forward vector m_Element[ 8] = sy; m_Element[ 9] = -sx * cy; m_Element = cx * cy; m_element = 0.0f; // w3 // translation m_element = 0.0f; // tx m_element = 0.0f; // ty m_element = 0.0f; // tz m_element = 1.0f; // w4
Edited by Kaptein, 30 September 2012 - 06:33 PM.