• Advertisement
Sign in to follow this  

Accessing Direct3D Texture Dimensions in C#

This topic is 4299 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

Is there any way to get the width and height of a Direct3D texture in C#? I know you can do it in C++ by using the D3DXCreateTextureFromFileEX function and passing in a pointer to a D3DXIMAGE_INFO struct to the function. Any thoughts? Thanks,

Share this post


Link to post
Share on other sites
Advertisement
Also, TextureLoader has an overloaded FromFile() method that takes an ImageInformation structure that gets filled in like the D3DXIMAGE_INFO structure.

Share this post


Link to post
Share on other sites
Note that Evil Steve's remark also applies here. If you load a 200x200 image into a texture, the actual texture size will probably be 256x256. To get this texture size, you can use the Width and Height in the surface description of the first MIP level:

SurfaceDescription sd = texture.GetLevelDescription(0);

Share this post


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

  • Advertisement