• Advertisement
Sign in to follow this  

D3DXCreateTextureFromFileEx Problem....

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

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
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.

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
Guest Anonymous Poster
One way to make it work is provide exact dimentions.

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
Sign in to follow this  

  • Advertisement