Archived

This topic is now archived and is closed to further replies.

Ratterbox

Direct3D - Texture Transformation Matricies

Recommended Posts

Ratterbox    157
Would somebody be able to give me some sample code as to how to use Texture Transformation Matricies in Direct3D, obviously to change the texture coordinates effectivly?? Thanks in advance.

Share this post


Link to post
Share on other sites
neneboricua19    634
It really depends on what you want to do. What kind of change do you want to make to your texture coordinates? The code for using texture transforms is pretty much the same as any of the other transforms. You use the same D3DXMATRIX and the same functions to calculate it''s values. The only thing that changes is the first argument to SetTransform.

For example, this matrix will add 0.2 to your texture coordinates.

D3DXMATRIX matTranslate;
D3DXMatrixTranslation( &matTranslate, 0.2f, 0.2f, 0.2f );
m_pd3dDevice->SetTransform( D3DTS_TEXTURE0, &matTranslate );

neneboricua

Share this post


Link to post
Share on other sites