View Full Version : OpenGL Matrices .....

03-17-2002, 04:51 PM
I have currently stumbled upon the GL_ARB_Transpose_Matrix Extension and recalled that loading a matrix from conventional memory was bound with a perfomance penalty. In the specs of this extension there is not much about performance, except that it does not matter much ( blabla... most opengl implementations can perform a transpose in place while reading from client memory efficiently ... blabla).
I have spent quite some time on our current project converting all 3x4 object matrices to quaternions and then their angle/axis counterparts. Now if loading a matrix with GL_ARB_Transpose_Matrix is faster or equal to glTranslatex(), glRotatex(), should I spend the same time in re-coding the old scheme again with 3x4 matrices per object?
Does anyone have some expierience with this ?

many thanks in advance,


03-17-2002, 05:12 PM
Benchmark it and tell us about it!

I'd suspect that the 'blabla' holds true. All you get is automated conversion from column major to row major formats. A little thinking tells me that twelve floats take up 48 bytes of memory which nicely fits into a 64 byte K7 cache line for example. It also fits into the 8 MMX registers every commodity PC has. And of course it fits into the larger register files of non-x86 machines.

Remember that the 'blabla' has been written as a hint towards the outcome of your question. Why bother asking?

03-17-2002, 05:52 PM
Originally posted by zeckensack:
Benchmark it and tell us about it!

i probably will soon. in our current approach we have a 3x4 matrix per object which when the object should be rendererd converted to a axis/angle & translation vector pair, then sent to opengl which then on it's own creates a 4x4 matrices to render the object. if i can submit the 3x4 object matrix to opengl and it takes it as it is (transposing should actually be no performance hit, but what about transferring (reading) data and the fact that extension calls are pointers to functions (intel x86 cache stalls)) i quess i should have a noticeable performance advantage - no more conversions - no more pain.

Originally posted by zeckensack:
Remember that the 'blabla' has been written as a hint towards the outcome of your question. Why bother asking?[/B]

currently it is 4 am, crunch-time for our project and i am definitly over-worked and so i silently hoped somebody would post "hey, against all common logic, it really does not make a difference. just let the code be... they just made this extension to confuse you" ;-)

thx, chris

[This message has been edited by crain (edited 03-17-2002).]