Gdi+ and Direct3D

Started by
4 comments, last by Omroth 14 years, 4 months ago
Hey guys. I'm moving a surface made with GDI+ onto the graphics card to be rendered with DirectX. Unfortunately, I have a problem. I am writing with GDI+ in "PixelFormat32bppARGB", but DX only seems to be happy with RGBA in 32 bit. Speed is quite important in this application - is there a fast solution to this that doesn't requre just swapping a load of bits? I'm using D3DXLoadVolumeFromMemory for the copy. Any help would be much appreciated. Thanks, Ian
Advertisement
Quote:Original post by Omroth
Unfortunately, I have a problem. I am writing with GDI+ in "PixelFormat32bppARGB", but DX only seems to be happy with RGBA in 32 bit.
Yep - DX9 requires that it be in that order. There's no real solution other than not using GDI+ or doing some sort of trick to get around it. I believe DX10 doesn't have this restriction, but it's also only Vista+.
Thanks Steve - guess I just have to do it the slow way...

Would you still use D3DXLoadVolumeFromMemory then swap the bits, or would you do it during the copy from main memory to gfx memory?

Thanks,
Ian
mhn...as far as I know and remember...DX9 can use the same as the GDI+ ARGB format. (its DX10 that have a different format with DXGI 1.0 (1.1 added the format to be used to cooperate))
Have you tried to simply copy it?
You might be faster re-implementing D3DXLoadVolumeFromMemory(), to avoid parsing the data twice.

Actually - looking at the DX9 docs, the format is D3DFMT_A8R8G8B8, which is ARGB order?
What the-? Ok, something's going on here.

This topic is closed to new replies.

Advertisement