Jump to content
  • Advertisement
Sign in to follow this  
Kimani

Textures rendering flat for some reason?

This topic is 4699 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

A little test program I was working on, after ironing out a few bugs, left me with this new challenge to overcome. Why exactly are the textures I'm applying coming out flat like this? I know it's doing something correctly... the colors it is displaying are not hardcoded, but the flattened color of the texture it should be displaying, somehow. As I haven't begun learning the voodoo of vertex and pixel shaders, I'm just using FVF. The texture coordinates, I am sure, are not something like (0,0) on all the vertices, and I do have D3DFVF_TEX1 thrown into the required places. As far as I can tell it's set up just like any other test I've written that correctly renders a texture... Any ideas as to what could be the problem?

Share this post


Link to post
Share on other sites
Advertisement
Well it looks to me like the texture coordinates are being set to 0,0. If you change the top-left pixel of the texture, you'll probably find that the polys will change to that color.

You said that the verts each had correct texture coordinates, so the problem probably lies in your vertex format.

You have to make sure that your vertex structure has the members in the right order. The order I'm doing them in is:

pos (3 floats)
normal (3 floats)
color (unsigned int)
tex coordinates (2 floats * texture channels)

for the FVF

D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_TEX4

If you're not using one of those, you can safely omit it, just make sure you keep the order the same.

Share this post


Link to post
Share on other sites
No, it should be D3DFVF_TEX1 if you have only one texture ^^
As MSDN say, the x in D3DFVF_TEXx is not an index, but the number of textures coordinates in the FVF.

Share this post


Link to post
Share on other sites
Quote:
Original post by PlayfulPuppy
You have to make sure that your vertex structure has the members in the right order.

That would be the one. Everything is working fine now. Let it be known that the order matters! Which makes sense now that I think about it, although the materials I was learning all this from never really made that clear, or put forth the order all the options that you have availible to you come in.

Thanks!

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!