Weird texture matrix problem 
Author Message
 Weird texture matrix problem

Hi, i have a small problem related to the texture matrix. I want to use a
texture matrix

so that I can change the area of the texture being rendered in each frame,
without

changing the u and v coordinates of each vertex manually. I am using
D3DXMatrixScaling

to produce a matrix, and then I pass this matrix to
Direct3DDevice8.SetTransform using

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.

What could be the problem?

Thanks in advance,
Spyros



Sat, 12 Feb 2005 03:06:33 GMT  
 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.



Fri, 18 Feb 2005 19:11:00 GMT  
 Weird texture matrix problem
I see... it works now, thanks a lot!

Spyros



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.



Sat, 19 Feb 2005 05:39:14 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Texture-matrix

2. problems with direct x agp texture acceleration

3. CreateTeaPot texture problem

4. Retained Mode problem loading textures

5. Please help me out, Textures Problem

6. Texture Mapping Problems.

7. A WEIRD, really weird question!

8. Compressed printing problem - dot matrix - Help!

9. VB5.0, labels and matrix printer problem

10. Please help : Very interesting problem - Matrices

11. Major Dot Matrix Printer Problem Using Win2000

12. Please help: Interesting problem - Matrices

 

 
Powered by phpBB® Forum Software