Jump to content
  • Advertisement
Sign in to follow this  
Headkaze

two textures with different coords

This topic is 4133 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have two textures which I'm alphablending on a primative each on it's own texture stage. The problem is I need stage zero to use texture coordinates tu and tv both of 1.0f and for the texture on stage 2 I need them to be 0.5. Is it possible to have two textures on the one primative using different texture coordinates?

Share this post


Link to post
Share on other sites
Advertisement
Sorry, can you please be clearer what I need to do. I am using TransformedColoredTextured custom vertex which has one tu and tv coord. How do I add more to this (is it a matter of creating my own custom vertex with an extra two tu and tv's?)? Also how do I say which coords are for which texture stage?

Share this post


Link to post
Share on other sites
Quote:
Original post by Headkaze
Sorry, can you please be clearer what I need to do. I am using TransformedColoredTextured custom vertex which has one tu and tv coord. How do I add more to this (is it a matter of creating my own custom vertex with an extra two tu and tv's?)?


Yes that's correct, you need to create your own custom vertex (unless they have a predefined one with 2 texture coordinate sets, I'm not sure).

Quote:

Also how do I say which coords are for which texture stage?


I believe the order decides this. The vertex declaration defines the length for each component in a certain order. So if you have texture coordinates for different stages in sequence then their data should be in the same sequence in your data type.

For example slightly edited from the DirectX 9 SDK documentation


D3DVERTEXELEMENT9 dwDecl3[] =
{
{0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT,
D3DDECLUSAGE_POSITION, 0},
{0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT,
D3DDECLUSAGE_COLOR, 0},
{0, 16, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT,
D3DDECLUSAGE_TEXCOORD, 0},
{0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT,
D3DDECLUSAGE_TEXCOORD, 1},
D3DDECL_END()
};



Note the stage index as the last parameter for the two texture coordinates.


struct MY_CUSTOMVERTEX
{
FLOAT x, y, z; // The untransformed position for the vertex
DWORD diffColor; // The vertex diffuse color
float tu_1, tv_1; // Texture coordinates for first texture
float tu_2, tv_2; // Texture coordinates for second texture
};

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!