Archived

This topic is now archived and is closed to further replies.

PlayGGY

Only the first pixel in the image loads.

Recommended Posts

I load an image onto a texture with D3DXCreateTextureFromFileEx, specify D3DX_DEFAULT for the hieght and width, but when I draw it too the screen it only shows the color of the first pixel of the image for the whole texture. I assume that it only loaded one pixel and is scaling it and is now filling the whole textue with the first pixel. Do you guys have some possible reasons.

Share this post


Link to post
Share on other sites
1. Make sure your texture coordinates are correct. Check that they arn''t all zero. Also make sure they arn''t negative and you''re clamping the texture, because that would also create texture coordinates that are 0.

2. Are you using a texture matrix by any chance?

---
Brent Gunning | My Site

Share this post


Link to post
Share on other sites
Sounds to me like a texture coord problem for certain. If you haven''t already fixed it (which it sounds like you have) just set your texture coords correctly. For instance, for a square they would be:

Vertex #1: (0.0f, 0.0f)
Vertex #2: (1.0f, 0.0f)
Vertex #3: (0.0f, 1.0f)
Vertex #4: (1.0f, 1.0f)

Good Luck

Share this post


Link to post
Share on other sites