Search code examples
c++visual-c++directxmanaged-directxdirect3d12

Creating a texture from a image in DX 12 VC++


I just want know Directx 12 API to create texture from image.

For DX11 it is D3DX11CreateShaderResourceViewFromFile and for DX9 it is D3DXCreateTextureFromFileEx and for DX12 ?


Solution

  • Things are a little bit better by now. Microsoft rewrote their DDSTextureLoader for DX12 and released it as part of their MiniEngine on GitHub https://github.com/Microsoft/DirectX-Graphics-Samples/blob/master/MiniEngine/Core/DDSTextureLoader.cpp

    You also may want to take a look at my derivative work that is intended to make use of the DDSTextureLoader a bit easier outside of MiniEngine. https://github.com/ClemensX/ShadedPath12/blob/master/ShadedPath12/ShadedPath12/DDSTextureLoader.cpp

    I use this loader for all my texture files. It parses DDS (DirectDrawSurface) file format pretty well, including mipmaps.