Sign in to follow this  
flashinpan

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

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
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

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