Thread: Texture Format Conversion

  1. #1
    Registered User
    Join Date
    Nov 2003

    Texture Format Conversion


    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

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Yes there is 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.

  3. #3
    Registered User
    Join Date
    Nov 2003
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. d3d9 c++ texture wrapper... again...
    By yaya in forum Game Programming
    Replies: 0
    Last Post: 04-01-2009, 01:08 PM
  2. D3d Texture Wrapper == ARRRGGGGHHH
    By yaya in forum Game Programming
    Replies: 1
    Last Post: 03-25-2009, 06:41 PM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Compression/Decompression Wave File and MP3
    By cindy_16051988 in forum Projects and Job Recruitment
    Replies: 51
    Last Post: 04-29-2006, 06:25 AM
  5. Pong is completed!!!
    By Shamino in forum Game Programming
    Replies: 11
    Last Post: 05-26-2005, 10:50 AM