• Advertisement
Sign in to follow this  

[DX] Get Texture Dimensions

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have an LPDIRECT3DTEXTURE9, and I need to grab it's dimensions. I'm looking through the public methods, but I don't see anything that looks like it will give me dimensions. I hope it's not something obvious that I missed. EDIT: It looks like I have to GetSurfaceLevel, then GetDesc on the surface from that, and then get the width and height from that. Is that the only way? It works but I have to use a lot of temporary variables.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Uphoreum
I'm looking through the public methods
Some are included with #define D3D_DEBUG_INFO, but don't rely on these - its an easy error to create [smile]

Quote:
Original post by Uphoreum
EDIT: It looks like I have to GetSurfaceLevel, then GetDesc on the surface from that, and then get the width and height from that. Is that the only way? It works but I have to use a lot of temporary variables.
Yup, thats pretty much it. The loading functions can return a D3DXIMAGE_INFO structure IIRC that can be a convenient way of retrieving information...

hth
Jack

Share this post


Link to post
Share on other sites
GetLevelDesc can get the description in one step, without getting the surface first, or having to release the surface afterwards.

The info returned from the loading functions describe the surface on disk, not the one in memory. If a texture is 60x100 grey scale (L8) on disk, it may be loaded as 64x128 X8R8G8B8. Depending on which information you want use the load info or the level descriptor. When loading non-pow2 textures, both come in useful. It's convenient to store both in your texture class.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement