Petr Schreiber
28-03-2009, 15:40
TBGL offers 3 basic transformations - translating, rotating and scaling.
When creating geometry on the fly, we can use TBGL_Translate, TBGL_Rotate and TBGL_Rotate to transform primitives.
In some situations, we would prefer to work with one triangle mesh, which would have all the transformations baked in.
Attached script shows multiple techniques:
- how the matrix magic works under the surface
- how to bake transformation to data structure
- how to use hi performance vertex arrays
Program allows you to cast transformations on triangle, as well as it shows complete dynamic matrix stack listing, so you can observe which parts of matrix represent what.
( first 3 columns are orientation of X, Y, Z axes, diagonal reflects scaling, last column translation )
I hope this will reveal at least part of mysteries related to matrices used in transforms,
Petr
UPDATED 29.03.2009
+ Added clearing the buffer
! Cleaned up matrix stack code
When creating geometry on the fly, we can use TBGL_Translate, TBGL_Rotate and TBGL_Rotate to transform primitives.
In some situations, we would prefer to work with one triangle mesh, which would have all the transformations baked in.
Attached script shows multiple techniques:
- how the matrix magic works under the surface
- how to bake transformation to data structure
- how to use hi performance vertex arrays
Program allows you to cast transformations on triangle, as well as it shows complete dynamic matrix stack listing, so you can observe which parts of matrix represent what.
( first 3 columns are orientation of X, Y, Z axes, diagonal reflects scaling, last column translation )
I hope this will reveal at least part of mysteries related to matrices used in transforms,
Petr
UPDATED 29.03.2009
+ Added clearing the buffer
! Cleaned up matrix stack code