Yes, the transformation matrix is given by the “TM_ROW” entries.
Say, your GL matrix is define as GLfloat, then you should read the coefficients as follows:
*TM_ROW0 0 1 2
*TM_ROW1 4 5 6
*TM_ROW2 8 9 10
*TM_ROW3 12 13 14
Then, for the other coefficients, you should put in the following values:
If you take the usual maths notation, those coefficients are not the last column but the last line of the matrix.
Now, I have a doubt regarding how to use this matrix to get your normals. I can’t remember if you must multiply the normals with the this matrix or with the transpose of this matrix… Try and see what happens (I’d say use the matrix itself)… The other solution, as I previously said, is to invert the matrix and transform back the vertices.
Now, when you multiply the normals by the matrix, you may introduce a scaling factor so you HAVE TO NORMALIZE the normals after multiplying.
You should also pay attention to your rendering code: let’s get back to the two methods:
- I have transformed the vertices back with the invert of my Matrix. The rendering code is:
- I have transformed AND normalized my normals.
Although 2) seems better, you lose all the hierarchy when doing this… It’s really up to you !