Sign in to follow this  
was2_0

D3DXCreateTextureFromFileEx with D3DX_DEFAULT in Width and Height cause problem...?

Recommended Posts

I find someone say that texture created using D3DXCreateTextureFromFileEx with D3DX_DEFAULT in Width and Height field will cause problem when use the texture with ID3DXSprite, is it true? If it's true, what about D3DXCreateTextureFromFile(without "Ex")? And what about D3DXCreateVolumeTextureFromResource and D3DXCreateVolumeTextureFromResourceEx? THANKS!

Share this post


Link to post
Share on other sites

Read the description of the function from

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/D3DXCreateTextureFromFileEx.asp

As far as I understand, using non-power-of-two texture file might cause some head ache, but nobody uses them right ?

Otherwise, textures created with this function should be as good as any other texture.

You could actually try it by yourself. if you find some problems, you can tell us about them.

Share this post


Link to post
Share on other sites
The "Ex" versions of the function allow you to get a D3DXIMAGE_INFO structure back, which tells you the size of the actual source image. You can then get the surface description for the top level of the texture to tell how large D3DX created it.
Often if you try to load a non-power of 2 texture, D3DX will create a texture surface that is the next power of 2 size up, and load the image into the top left corner.
Example: If you load a 200x200 image, D3DX will probably allocate a 256x256 texture. The D3DXIMAGE_INFO will tell you that the image was 200x200, and getting the level 0 surface description will tell you the texture is 256x256. That allows you to adjust the RECT you pass to ID3DXSprite::Draw so you don't include the unused parts of your texture.

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