0

Like in the question, is it possible to do this? If not what can be good thing to render 2D sprites from files in DirectX11? If it is possible then how can i do this? I found some things in the web like Render a BMP, JPEG, or PNG Image with DirectX? (from this question i got the idea). I also saw some resources at microsoft website, however i have no idea how to use theese things.

Community
  • 1
  • 1
M4c13K
  • 13
  • 1
  • 2

1 Answers1

0

Use DirectX Tool Kit.

  • DDSTextureLoader.h has functions for loading textures from DDS files
  • WICTextureLoader.h has functions for loading textures from image files using Windows Imaging Component such as PNG, JPEG, BMP, etc.
  • SpriteBatch is a class for drawing 2D sprites using Direct3D 11 textures

Note that D3DX11CreateTextureFromFile is part of the deprecated D3DX11 library which is only available in the legacy DirectX SDK. See MSDN, Where is the DirectX SDK?, and Living without D3DX.

Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81
  • Advance Thanks! Are there any DXTK tutorials or i need to read through docuemntation or something – M4c13K Nov 19 '14 at 17:43
  • There's a suite of [simple samples](https://directxtk.codeplex.com/wikipage?title=Samples) for DirectX Tool Kit depending on your platform target, as well as [documentation](https://directxtk.codeplex.com/documentation) on the CodePlex Wiki. – Chuck Walbourn Nov 19 '14 at 19:50
  • Getting theese errors when trying to compile dxgi1_2.h(1271): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int dxgi1_2.h(1271): error C2143: syntax error : missing ',' before '*' dxgi1_2.h(1275): error C2061: syntax error : identifier 'DXGI_RGBA' – M4c13K Nov 19 '14 at 20:46
  • What compiler are you using? VS 2012 or 2013 have the Windows 8.x SDK integrated already so they work "as is". If you are using VS 2010, you need to use the [props](http://blogs.msdn.com/b/vcblog/archive/2012/11/23/using-the-windows-8-sdk-with-visual-studio-2010-configuring-multiple-projects.aspx) solution to using the Windows 8.1 SDK after installing it--the DirectXTX package includes the required .props files. If you are *already* using the legacy DirectX SDK, you need to modify the include/lib paths to make the Windows 8.x SDK first, legacy DirectX SDK second (per the MSDN link above). – Chuck Walbourn Nov 19 '14 at 22:23
  • Sorry for long not responding. I have VS2013. If it is important i have VS2012 installed on my machine too – M4c13K Nov 20 '14 at 15:40
  • If that helps i use Windows 7 Home Premium SP1. – M4c13K Nov 20 '14 at 18:42
  • If you are using Windows 7, then you can still use VS 2012/2013 and the Windows 8.X SDK, but XAudio 2.8 and XInput 1.4 are not supported for Windows 7. – Chuck Walbourn Nov 20 '14 at 19:48
  • Don't worry about theese two... the real problem is that application is not compiling because of dxgi1_2.h – M4c13K Nov 20 '14 at 20:31