Sign in to follow this  
axv4745

Accessing Direct3D Texture Dimensions in C#

Recommended Posts

axv4745    108
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
Dave Hunt    4872
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
remigius    1172
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this