D3DXCreateTextureFromFileEx

Started by
1 comment, last by mk1x86 16 years, 10 months ago
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?
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.
This is called batching?
Thanks for your info.

This topic is closed to new replies.

Advertisement