Display BMP, JPEG or PNG image using DirectX?

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

I saw this easily using the OpenGL Java library (JME, I think?), But it looks like DirectX needs textures and doesn't accept regular images. :(

It is right? If so, how can I programmatically convert it to a texture?

+4
source share
1 answer

DirectX 9: D3DXCreateTextureFromFile

DirectX 10: D3DX10CreateTextureFromFile and D3DX10CreateShaderResourceViewFromFile

DirectX 11: D3DX11CreateTextureFromFile and D3DX11CreateShaderResourceViewFromFile

Read the details for each, but most supported file formats are supported. (including 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 source code examples in chapter 7. Perhaps you could buy a book.

+8
source

All Articles