• 10
• 9
• 12
• 14
• 15

# id3dxsprite enlarges picture

This topic is 4372 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites
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 on other sites
Awesome, that did the trick.
Thanks.

##### Share on other sites
Why not just use the D3DX_DEFAULT_NONPOW2 param?

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

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