none
DirectX 3D Create texture

    Question

  • I am coding an 3D app on Windows 8 and looking for information about DirectX 3D on Windows 8. I used StarterKit sample to load file.fbx, I can change color for 3D mesh but I want to load image as skin of 3D mesh, how can I create textures from image and apply texture for 3D mesh?. Please let me know if you know any DirectX API that can handle this behavior in Windows 8? 

    Wednesday, November 21, 2012 2:59 AM

Answers

  • DirectXTK includes DDSTextureLoader and WICTextureLoader.

     

    DDS is supported for Windows Store apps and Windows phone 8 apps

    using namespace DirectX;
    using namespace Microsoft::WRL;
    
    ComPtr<ID3D11ShaderResourceView> srv;
    HRESULT hr = CreateDDSTextureFromFile( d3dDevice, L"SEAFLOOR.DDS", nullptr, &srv )
    ThrowIfFailed(hr);

    WIC-based image formats (JPG, BMP, TIFF, GIF, etc.) are supported for Windows Store apps using WIC, which is not available on the Windows phone 8 platform.

    using namespace DirectX;
    using namespace Microsoft::WRL;
    
    ComPtr<ID3D11ShaderResourceView> srv;
    HRESULT hr = CreateWICTextureFromFile( d3dDevice, immContext, L"LOGO.BMP", nullptr, &srv )
    ThrowIfFailed(hr);



    Wednesday, November 21, 2012 8:48 PM