• Advertisement
Sign in to follow this  

[SOLVED NOW] XNA - SpriteTexture Width is wrong for some reason

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

In my XNA game: The image is 32 x 96, but when I set a breakpoint in the code and look at SpriteTexture.Width, it is saying 128, not 96. It is off by a full 32 pixels! Why might this be? Full source is downloadable here: Latest Source Code You can see the Bug in ChangeSet 17143 (which right now is the latest one) [Edited by - Tom Knowlton on November 12, 2008 10:34:01 PM]

Share this post


Link to post
Share on other sites
Advertisement
Textures in XNA must be a power of 2, so it's resizing your 32x96 texture to the next largest power of 2, 32x128.

Share this post


Link to post
Share on other sites
Quote:
Original post by Codeka
Textures in XNA must be a power of 2, so it's resizing your 32x96 texture to the next largest power of 2, 32x128.


Very interesting. Makes sense!

Finally had time to try it...yep...that was the problem.


Thank you,

Tom

Share this post


Link to post
Share on other sites

For future reference the texture dimensions don't have to be power of 2, but olders graphics cards don't support non-power-of-2 texture dimensions. So the content pipeline is set to convert the textures to power of 2 dimensions by default, but you can turn that off on the texture's properties sheet when you're feeling bold [wink]

Share this post


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

  • Advertisement