Or justOriginally Posted by dmantione
[pascal]glLoadMatrixF(@m.transpose.data);[/pascal]
Actually, it would be nice to add a unit like GLMatrix that defines overloaded versions of glLoadMatrix routines that just take Tmatrix4_single/double as arguments and do the transpose inside implementation.
I even thought about doing descendants like TMatrix4_single_GL that have methods like glLoadMatrix with implementation like
[pascal]
procedure TMatrix4_single_GL.glLoadMatrix;
begin
GL.glLoadMatrix(@transpose.data);
end;
[/pascal]
... but this will not be so nice, since you will have to override some operators again for new TMatrix4_single_GL class, and if you receive your matrix instance from some non-OpenGL-related unit then it will still have normal TMatrix4_single class, not TMatrix4_single_GL. So making non-object procedures like glLoadMatrix(M: TMatrix4_single) would be more general solution to "hide" the "transpose." call from the eyes of the programmer.
Bookmarks