Jump to content
  • Advertisement
Sign in to follow this  
mk1x86

D3DXCreateTextureFromFileEx

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

For my GUI I'm using bitmaps that are not power of 2 size. Actually the engine shall use pow2-textures but to save space on my hard disk I'd like to save my bitmaps in any size I like. D3DXCreateTextureFromFileEx does a good job in resizing the bitmap to the nearest power of 2 height/width but it stretches my bitmap. I'd like to have a black (transparent if required) bitmap with power of 2 size and my original bitmap blitted in the top left corner (without resizing the pixel of the original bitmap). Any ideas how to do that?

Share this post


Link to post
Share on other sites
Advertisement
Set the Filter parameter to D3DX_FILTER_NONE. This will get you black/transparent black in the unused parts of the texture. Pass a pointer to an info structure to the load call. It will return the texture size of the texture on disk (ie: 100x90). You can then call GetLevelDesc(0, ...) on the texture to get the size of the texture created (128x128). These two bits of info can be used to generate your UV coordinates.

You really should put all these small textures onto a single texture page (or a few pages), allowing you to render many objects in one draw call.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!