How do I generate a D3DFMT_A4R4G4B4 bitmap file?

Started by
3 comments, last by Eddie Zehoo 19 years, 11 months ago
Hello, If I set my pixel format to D3DFMT_A4R4G4B4, how do I make sure my BMP files are also in this format? Is there a converter that will convert my images into this format? Also, is this pixel format popular among games? Thanks for any help that comes my way Regards, Eddie 00000100-00100011-10000000
00000100-00100011-10000000
Advertisement
This is not a well-supported format among graphics cards. I know of no games that use it.

If you want small storage textures with alpha, use DXT5 compressed textures.

If you want a small framebuffer, use R5G5B5 if available, else 565. If you want a framebuffer with alpha, you pretty much need 8888.
enum Bool { True, False, FileNotFound };
Hi hplus0603
Thanks for the input. This might sound like a stupid question, but do I have to change my BMP bitmap image in any way to match the pixel format that I set in Direct3D?

Or if I''m guessing correctly, Direct3D converts the bitmap image into the correct pixel format when I do D3DXCreateTextureFromFile() ?

Thanks in advance for yuor help,
Regards,
Eddie



00000100-00100011-10000000
00000100-00100011-10000000
Yep, you are guessing correctly. If you use the standard D3DXCreateTextureFromFile() function Direct3D will convert the image for you. Most likely it will get converted into the same format as the back buffer.

If you use the D3DXCreateTextureFromFileEx() function, you can specify what format you want the image created in.
quote:Original post by hplus0603
This is not a well-supported format among graphics cards.


I''d actually disagree with that - IIRC even the Matrox Mystique supported 4444 for textures (albeit with stippled alpha due to it not being capable of proper blending).
It won''t be well supported (if at all) as a render target format though.


quote:I know of no games that use it.


Games that have to run on older hardware will have support for that format for textures but will choose DXT or even 8888 where available.


quote:If you want small storage textures with alpha, use DXT5 compressed textures.

If you want a small framebuffer, use R5G5B5 if available, else 565. If you want a framebuffer with alpha, you pretty much need 8888.


Yep, I agree totally.


Eddie Zehoo: Most games don''t use 4444 format in their files, instead they use something like, say, 8888 and then convert down if 4444 needs to be used. Where DXT compressed textures are concerned, most people store in that format on disk (*.DDS files, check out the DirectX Texture Tool)

Simon O''Connor
Game Programmer &
Microsoft DirectX MVP

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

This topic is closed to new replies.

Advertisement