Weird texture matrix problem

Quote:

> the D3DTS_TEXTURE0 flag. Then I use DrawPrimitiveUP and I can see the

> results of using a texture matrix.

> However, this works only with matrices used for scaling. If I use

> D3DXMatrixTranslation to build a translation matrix and then use it as

the

> texture matrix, my texture is rendered normally,as if there was no

texture

> matrix at all. No matter what x,y and z values I give to

> D3DXMatrixTranslation, the result is the same: I can see no change in

the

> way the texture is rendered.

I presume you are using 2D texture coordinates (u,v)? The

D3DXMatrixTranslation function will place the translation in the fourth

row of the matrix. However, a texture coordinate matrix for N

dimensional texture coordinates will apply the translation provided in

the (N+1)th row of the matrix, so for 2D coordinates it will apply the

third row of the matrix. You'll have to create your own translation

matrix, which is easy enough to do - create an identity matrix then set

the first two values in the third row as your x and y translation.

--

Robert Dunlop

The X-Zone

http://www.mvps.org/directx

Microsoft DirectX MVP

-------------

The opinions expressed in this message are my own personal views and do

not reflect the official views of the Microsoft Corporation.

The MVP program does not constitute employment or contractual obligation

with Microsoft.