Sign in to follow this  

Non power of two texture in DirectX

This topic is 1895 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 am trying to load textures in the same way as the rastertek tutorials do it, but when I get to the font tutorial, the texture for the font won't load. After some thorough detective work, I determined that it was because one of the texture dimensions was not a power of two. How can I get directx to load any texture regardless of size?

Edit: Just figured out that he uses a power of two texture for the font and posted a different texture on his website (with a bad size). Regardless, I would still like to know how to handle non-power-of-two textures Edited by viper110110

Share this post


Link to post
Share on other sites
In D3D9 you have to check the 'CAPS' to see if the GPU supports non-power-of-2 (NPOT) textures or not... but D3D10 instead mandates that all D3D10 GPUs [b]must[/b] support NPOT textures, so you shouldn't have to tread POT/NPOT textures differently at all.

What kind of errors are you getting with your NPOT texture?

Share this post


Link to post
Share on other sites
E_INVALIDARG is the return value of CreateDDSTextureFromFile

I tested this by changing one of my regular textures to 307x256

EDIT: upon further digging, I have found that the function call to CreateD3DResources in DDSTextureLoader.cpp is returning this value Edited by viper110110

Share this post


Link to post
Share on other sites
Sign in to follow this