TimNyborg
asked on
Finding the Width of a DirectX 9 Texture
I've written a graphics engine for a 2d game using the DirectX 9 'Sprite' system.
I simply need to know how to find the widths of strangely dimensioned textures during runtime (eg 80x60, 400x120, etc...)
I simply need to know how to find the widths of strangely dimensioned textures during runtime (eg 80x60, 400x120, etc...)
ASKER
I've tried that method, but level 0's width and height are converted to powers of 2, equal to or greater than the original dimensions
ie 40x80 becomes 64x128
Is there
ie 40x80 becomes 64x128
Is there
ASKER
whoops
*Is there a way to keep the original size? As far as I can tell, the textures are being expanded to meet 2^n sizes, but that doesn't matter when you go to draw them as sprites, because the extra area is transparent
I just need to find the centers of the actual original image so I can place image on top
*Is there a way to keep the original size? As far as I can tell, the textures are being expanded to meet 2^n sizes, but that doesn't matter when you go to draw them as sprites, because the extra area is transparent
I just need to find the centers of the actual original image so I can place image on top
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It sounds like you can solve this with the GetLevelDesc method.
LPDIRECT3DTEXTURE9 pTexture;
D3DSURFACE_DESC desc;
pTexture->GetLevelDesc(0,&
int width = desc.Width;
int height = desc.Height;
The D3DSURFACE_DESC structure has a lot of other members, but I doubt they'd be very helpful to you.
Good luck