Jump to content
  • Advertisement
Sign in to follow this  
theMadHatter

id3dxsprite enlarges picture

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

Hi, When I use the ID3DXSprite function CreateSprite CreateTextureFromFile then draw it using that texture it seems to enlarge the picture. Is there a way to have this not happen. Like setting a rect or something. Thanks

Share this post


Link to post
Share on other sites
Advertisement
Make sure that the texture conforms to the power of 2 size convention. Otherwise the device might want to resize it.

Power of 2 sized textures are sizes such as
64, 128, 256, 512, 1024 and so forth.

I hope this helps.
Take care.

Share this post


Link to post
Share on other sites
Well I guess that would work too. Now that I know about it. Thanks as well.

edit: Well i put at the top of my page
#define D3DX_DEFAULT_NONPOW2
And it gave me the error:
warning C4005: 'D3DX_DEFAULT_NONPOW2' : macro redefinition
and telling me to look at the previous definition
And the one in the d3dx9.h was like this:
#define D3DX_DEFAULT_NONPOW2 ((UINT) -2)
So I put that in, it didn't give me an error but it also still enlarged my picture. So I don't know what's wrong with that.

Share this post


Link to post
Share on other sites
You're hardware has to support arbitrary texture dimentions for that to work. See the docs on D3DPTEXTURECAPS_POW2 and D3DPTEXTURECAPS_NONPOW2CONDITIONAL in the D3DCAPS9 structure within the TextureCaps.

If both of those are not set, then you can load in textures with arbitrary size. If both are set, then you can load in textures with any size, but a few conditions have to be met. If only D3DPTEXTURECAPS_POW2 is set then you need to use power of 2 textures.

in your case


if( caps.TextureCaps & D3DPTEXTURECAPS_POW2 ) // is probably true

Share this post


Link to post
Share on other sites
I have pretty decent hardware on my computer. I'm guessing that's what you meant by hardware. So the solution is just using powers of 2? Bummer.

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!