Sign in to follow this  
raylee

D3DXCreateTextureFromFileEx Problem....

Recommended Posts

I use D3DXCreateTextureFromFileEx to load texture. However, for the texture dimension is not power of 2, it automatically rounds up the texture. Do anybody have this problem before? P.S. : I am using ATI 9800SE card. I have checked that it support D3DPTEXTURECAPS_POW2. Also, D3DX_DEFAULT_NONPOW2 are set in the texture function.

Share this post


Link to post
Share on other sites
I believe that is what is supposed to happen. You may have to pad your textures, or load them in a LPDIRECT3DSURFACE9 and use stretchrect, if that is a viable solution to your problem.

Share this post


Link to post
Share on other sites
yes, this is definitely not a problem. This is what happens when you use this function for a number of reasons. Powers of 2 are the native base for computers so it only makes sense that it would convert textures to a power of 2 for performance reasons.

Share this post


Link to post
Share on other sites
Quote:
Original post by raylee
I use D3DXCreateTextureFromFileEx to load texture.

However, for the texture dimension is not power of 2, it automatically
rounds up the texture.
Do anybody have this problem before?

P.S. : I am using ATI 9800SE card. I have checked that it support
D3DPTEXTURECAPS_POW2.
Also, D3DX_DEFAULT_NONPOW2 are set in the texture function.


If the D3DPTEXTURECAPS_POW2 capability flag is set, it means that the card requires power-of-two texture dimensions, not the other way round as you think. This explains why the loader forces the dimensions.

You can disable texture loader from resizing the texture by setting the filter parameter to D3DX_FILTER_NONE - however, the loader will then pad the texture with transparent black (or clamps the dimensions) to comply with the hardware's texture size limitations.

Check for the D3DPTEXTURECAPS_NONPOW2CONDITIONAL flag also - the card may support non-p2 textures with special conditions as specified in the SDK.

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