   Querying texture dimensions
  hi alli use D3DXCreateTextureFromFile to load a texture, then D3DXCreateSprite to use the loaded texture as a simple sprite.is there a way of querying either of these to find the dimensions of the image? it's for a menu item that i want the user to be able to click with the mousealso a bit off-topic but still texture-related and just something that's niggling me.the background for my menu is a 640*480 targa file. depending on screen size i scale it in the 'y' direction to fit fullscreen after doing a call to get the screen dimensions, yet for some reason i don't need to do this in the 'x' dimension as it magically comes out like that already (even if i dont scale the 'y')... in 1024 pixels, but nothing higher than that. i don't see why it'll stretch to fit 1024 if it's 640width but if i try to scale it for anything bigger it still comes out too wide :-/cheers everyone :)[Edited by - Mantrid on December 4, 2005 10:24:21 PM]
Quote:Original post by Mantridi use D3DXCreateTextureFromFile to load a texture, then D3DXCreateSprite to use the loaded texture as a simple sprite.is there a way of querying either of these to find the dimensions of the image? it's for a menu item that i want the user to be able to click with the mouseYou can call D3DXGetImageInfoFromFile before loading the file to get its info (including dimensions). Or you can call IDirect3DTexture9::GetLevelDesc to retrieve the description of level 0, which also contains the width and height.The former will return the dimensions of the file, which might not be the same as those of the texture - D3DXCreateTextureFromFile can and will scale the texture in certain situations.;  oh that's brilliant, i'll try all that out. could also explain the second problem maybe, cheers :)edit: i used D3DXGetImageInfoFromFile and that got the first problem solved thanks very much!! just wondering about the second now[Edited by - Mantrid on December 4, 2005 10:25:11 PM]