Render a BMP, JPEG, or PNG Image with DirectX?

16,372

DirectX 9: D3DXCreateTextureFromFile

DirectX 10: D3DX10CreateTextureFromFile and D3DX10CreateShaderResourceViewFromFile

DirectX 11: D3DX11CreateTextureFromFile and D3DX11CreateShaderResourceViewFromFile

Read the details of each, but most all of the popular file formats are supported. (includes BMP, JPG, and PNG)

Go here: http://www.jblearning.com/catalog/9781598220537/

Download the "source code part II" from the "samples and resources" section. Look at the chapter 7 source code samples. Optionally, you could buy the book.

Share:
16,372
user541686
Author by

user541686

Updated on June 04, 2022

Comments

  • user541686
    user541686 almost 2 years

    How do you render a BMP, JPEG, or PNG image file in 3D with DirectX in Windows? (E.g. let's say I want to render four images so that they look like a cubicle or something.)

    I've seen this done easily with a Java OpenGL library (JME I think?), but it seems like DirectX needs textures, and doesn't take in regular images. :(

    Is this correct? If so, how do I convert it to a texture programmatically?

  • Kracken
    Kracken almost 5 years
    unfortunately, link is now broken
  • Saurav Seth
    Saurav Seth almost 5 years
    @Kracken - Unfortunately, the book I was referencing may be out of support by the publisher. However, just go to Amazon and look for books by Frank Luna including any of his "Introduction to 3D Game Programming" series. I'm fairly certain that was what I was referencing.