Basic question about ID3DXSprite

Started by
4 comments, last by mdias 19 years, 3 months ago
Should the texture be in power of 2 so for the ID3DXSprite::Draw method works correctly? When I use a texture with size in power of 2, like 1024x1024 or 512x2048, the second parameter from that method works fine, that is to say the portion of the source texture defined by the RECT structure is showed correctly. But in other sizes (not power of 2), the method captures a portion different from that that was defined for the RECT structure. Thanks in advance.
Advertisement
yeah i think that's right, the dimensions of the texture have to be divisible by two
Some video cards require power-of-two textures. Some don't. Newer ones generally don't. You can check the device capabilities either from DirectX or with the utility included in the SDK.

Chris
Chris ByersMicrosoft DirectX MVP - 2005
For 2D, you can use non-pow2 textures too, just make sure you use D3DX_FILTER_NONE for the filters in D3DXCreateTextureFromFileEx(). Look up that function in the SDK documentation and you will get more information.
Thanks Pipo, It was that.

Just other question: - Is there some restriction to the texture size?
For example: If each frame from the sprite has a size of 256x256, and I have 25 frames, so could I use 256x6400 instead 1280x1280?
Texture size limits are specified in D3DCAPS9.MaxTextureWidth and D3DCAPS9.MaxTextureHeight, the limits depend on the hardware.

[Edit] yes, you could do that by then altering U and V coordinates of the texture, but be aware of texture size limitations.

This topic is closed to new replies.

Advertisement