Sign in to follow this  

Texture Problem

This topic is 4108 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'm having a slight problem with putting a texture onto a 2D square I have created. Everything seems to be set up correctly, the square even changes colour to the colour of the texture. The problem is the actual texture doesn't show on the square. Am I right in thinking I just need to adjust the normals on my 2D square?

Share this post


Link to post
Share on other sites
Vertex normals only affect lighting, they won't affect texture mapping.

The texture coordinates of each vertex in the square are what will affect texture mapping.

To map onto a simple square made from two triangles, if the vertices (P1, P2, P3, P4) of your square look like:

P1------P2
| \_ |
| \_ |
| \_ |
| \|
P4------P3


then your U and V texture coordinates to map all of the texture onto all of the square would be:

P1: U=0, V=0
P2: U=1, V=0
P3: U=1, V=1
P4: U=0, V=1

Share this post


Link to post
Share on other sites
And make sure you don't have D3DRS_WRAP0 turned on. It's some freak version of wrapping that will only cause you pain. :) For a standard quad with correct UVs, it would actually produce a solid color like you're seeing.

It's the sampler states D3DSAMP_ADDRESSU, ADDRESS_V that should be used to control wrapping, clamping, mirroring, etc.

Share this post


Link to post
Share on other sites

This topic is 4108 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this