在DirectX 11.1中加载纹理 [英] Load texture in directX 11.1

查看:286
本文介绍了在DirectX 11.1中加载纹理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读DX11的 http://www.braynzarsoft.net/ 教程,但我主要学习使用Metro风格的应用程序在DX11.1上进行编程。我继续学习
时,发现DX1中不再包含Dx11中的某些功能,例如 D3DX11CreateShaderResourceViewFromFile 该教程用于加载纹理,但在DX11中。 1我们没有这个!
我的问题是如何在DX11.1中加载DDS纹理?
我想在此代码中替换该函数,以便加载DDS纹理:

I'm reading http://www.braynzarsoft.net/ tutorials for DX11 but I mainly learning programming on DX11.1 with metro style app. as I continue to learn I find out some features in Dx11 are not anymore in DX11.1,like D3DX11CreateShaderResourceViewFromFile that tutorial used to load a texture but in DX11.1 we doesn't have this! my question is how can I load a DDS texture in DX11.1 ? I want to replace that function in this Code so that I can load a DDS texture:

hr = D3DX11CreateShaderResourceViewFromFile( d3d11Device, L"braynzar.jpg",
        NULL, NULL, &CubesTexture, NULL );

    // Describe the Sample State
    D3D11_SAMPLER_DESC sampDesc;
    ZeroMemory( &sampDesc, sizeof(sampDesc) );
    sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
    sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
    sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
    sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
    sampDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
    sampDesc.MinLOD = 0;
    sampDesc.MaxLOD = D3D11_FLOAT32_MAX;

    //Create the Sample State
    hr = d3d11Device->CreateSamplerState( &sampDesc, &CubesTexSamplerState );


推荐答案

看看 DirectxTK

编辑他明确要求如何加载DDS纹理。在拒绝投票之前,请仔细阅读问题。

edit He explicitly asks how to load a DDS texture. Please read the question carefully before down-voting.

这篇关于在DirectX 11.1中加载纹理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆