Original Post
Yesterday I was having some problems setting up the texture stages to modulate one texture with another (see my post Multitexturing Problem from 01-16-04). I got that figured out, but the problem that I''m having now is that I can''t get the texture coordinates right for stage 1. No matter what values I use for my second set of texture coordinates, it uses 0,0 for stage 1.
I know this is the case because when I had a white pixel in the upper left hand corner of my texture, texture stage 1 seemed to have no effect (because I was multiplying by 1 since the pixel is white). When I changed the upper left hand pixel to red, the image looks red, so I came to the conclusion that texture stage 1 is using 0,0 for the texture coordinates, no matter what coordinates I specified.
Here is my FVF definition
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL| D3DFVF_DIFFUSE|D3DFVF_TEX2|D3DFVF_TEXCOORDSIZE2(0)|D3DFVF_TEXCOORDSIZE2(1))
and my CUSTOMVERTEX struct looks like this
struct CUSTOMVERTEX
{
D3DXVECTOR3 position; // vertex position
D3DXVECTOR3 normal; // vertex normal
D3DCOLOR color; // The color
FLOAT tu, tv; // The texture coordinates
FLOAT tu2, tv2; // The second set of
// texture coordinates.
};
I am filling the vertex buffer like this
verticies[0].position = D3DXVECTOR3(0, 1.5, 0);
verticies[0].normal = D3DXVECTOR3(0, 0, -1);
verticies[0].color = D3DCOLOR_RGBA(255, 0, 0, 85);
verticies[0].tu = 0; //coordinates for stage 0 texture
verticies[0].tv = 1;
verticies[0].tu2 = 0; //coordinates for stage 1 texture
verticies[0].tv2 = 1;
For the other verticies I used texture coordinates (1,1) and (0,0).
What else to I have to do to get DirectX to recognize and use my texture coordinates for stage 1?
Thanks.