Storing non 2^x sized .DDS for use with ID3DXSprite

From what I've seen, when using D3DXCreateTexture with sprites that aren't properly sized (2^x) everything is automatically taken care of. When displaying them as sprites with ID3DXSprite they are shown in proper size.

But this takes some time to load if you have a lot of sprites. Especially if you want to generate mipmaps and apply texture compression on top of it. Obviously it's a lot faster to load .DDS data, if you've already applied the texture compression and pregenerated the mipmaps. This sounds like a nice alternative, but this format doesn't seem to support sprites of arbitrary sizes (when using compression)?

I'm thinking that maybe you can get around this by stretching the sprites, and then specifying another height/width manually through D3DXCreateTextureEx or so, but how can I guarantee that my stretching is done the same way that ID3DXSprite do the shrinking? Without distorting the sprites? Or can I just fill out my sprites to the right/bottom with black borders/zero alpha or something?

[1024 byte] By [hee00awa] at [2007-12-27]
# 1

By compression I'll assume you mean the DXT1-DXT5 modes. In which case, the documentation explains the compressed format - they key being that they operate on blocks of 4x4 pixels. Any texture/surface stored in a compressed format must be a multiple of 4 in height and width.

If you want to store non 2^n sprites in compressed form you will, as you suggest, have to pad the extra pixels with transparent/blank data and adjust your texture coordinates accordingly.

hth
Jack

JackHoxley at 2007-9-4 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...