Skip to main content
GameDev.net gamedev.net
🔒 Locked

Texture Problem

Started by Cloud_Phoenix Sep 14, 2006 at 2:09 PM 1 replies 850+ views
Original Post
Cloud_Phoenix
Cloud_Phoenix
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?
S1CA
S1CA
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

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site
Namethatnobodyelsetook
Namethatnobodyelsetook
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.