Hi,
I have a LPDIRECT3DTEXTURE8 in the format D3DFMT_YUY2.
When i display it to screen on a quad the colors are all screwed up.
Is there anyway to convert this to an RGB Texture to display it correctly?
Any help appreciated
Hi,
I have a LPDIRECT3DTEXTURE8 in the format D3DFMT_YUY2.
When i display it to screen on a quad the colors are all screwed up.
Is there anyway to convert this to an RGB Texture to display it correctly?
Any help appreciated
Yes there is ....at least with DirectX9.
Fire up the DirectX texture tool (DirectX SDK->Utilities->DirectX Texture Tool) and load your bitmap into it.
Then go to format and select Change Surface Format. Select the format you want - probably A8R8G8B8 and then save it as a DDS. From your code now you get to the file like this:
D3DXCreateTextureFromFile(LPDIRECT3DDEVICE9 pDevice,LPCSTR pFile,LPDIRECT3DTEXTURE9 *ppTexture);
Simply pass your dds file in the pFile parameter and you are done.
The DDX file functions can readily load DDS files at no extra code cost to you.
Thanks for the reply..
The problem is, i'm getting the texture from within a running program while i'm decoding a video file.
I'm decoding the video then displaying the texture on a quad.
The video/sound from the file play fine, just wrong colours!
I have searched around for YUV 2 RGB Conversion information and found a few results, but i can't seem to get it right.
The video texture comes out with too much Green or too much Blue.
Thanks again.
Marc