c++ - "D3DX11CreateShaderResourceViewFromFile"让它工作或寻找替代品

标签 c++ directx

我是 DirectX 的新手,我正在尝试使用我在网上找到的一些示例代码来工作。显然它需要 D3DX11tex.h 和 D3DX11.lib,但它总是说它无法打开标题。我试过使用 CreateWICTextureFromFile,但我真的不知道自己在做什么,我们将不胜感激。如果有帮助,我会在 Windows 10 上使用 Visual Studio 2017。

最佳答案

所有 D3DX9、D3DX10 和 D3DX11 以及旧版 DirectX SDK 的其他一些方面都已弃用。您可以继续在带有 VS 2012 或更高版本/Windows 8.x SDK/Windows 10 SDK 的经典 Win32 桌面应用程序中使用它们,但您必须适本地添加 DirectX SDK include/libs 并小心使用它们。这在 MSDN 上有详细介绍.另见 this blog post .

Living without D3DX 有很多选项,并且建议新应用程序尽量减少或避免使用旧版 DirectX SDK。 The Zombie DirectX SDK 中详细介绍了需要旧版 DirectX SDK 的唯一情况。 -- 除了从各种过时的 DirectX 11 书籍和在线教程中学习的人。

DirectX Tool Kit 中的 CreateWICTextureFromFile 函数是一个很好的解决方案,它根本不需要旧版 Directx SDK,并且记录在案 here .它也包含在此 tutorial series 中.

Keep in mind that the D3DX11 texture loaders were also "everything and the kitchen sink" implementations. The DirectXTex library supports all kinds of legacy loaders, format conversion, resizing, etc. that was supported by D3DX11. For runtime use, however, DirectX Tool Kit is a much faster, leaner, more elegant solution assuming you can do any required legacy conversions at build-time. See this post.

关于c++ - "D3DX11CreateShaderResourceViewFromFile"让它工作或寻找替代品,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48067434/

相关文章:

c++ - 使用 SDL_SetVideoMode 时,有没有办法获取内部 SDL_Window 指针或 ID?

c++ - 如何删除输出末尾的逗号?

c++ - 在qt中添加菜单栏时出错

c++ - C++20 中允许 east constexpr/constinit/consteval 吗?

c# - XNA 与 DirectX (C#) 的比较

c++ - DirectX 9 中的数据流是什么?

c++ - 如何将命令行参数传递给 c 程序

c++ - 精确的纹理叠加

c++ - Direct3D 发现 2D 屏幕坐标有效,但在受到压力时出现镜像故障

hyperlink - DirectX 11 链接错误 : fatal error LNK1104: cannot open file 'Effects11d.lib'