D3DXCreateTextureFromFileEx Problem....

Started by
4 comments, last by raylee 18 years, 10 months ago
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.
Advertisement
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.
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.
One way to make it work is provide exact dimentions.
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.

Niko Suni

Thank all!

This topic is closed to new replies.

Advertisement