D3DX11 and tga

Started by
2 comments, last by Dawoodoz 13 years, 1 month ago
I cannot get a tga file loaded via D3DX11CreateShaderResourceViewFromFile

hr = D3DX11CreateShaderResourceViewFromFile( g_pd3dDevice, Input.c_str(), NULL, NULL, &Result->mShaderResourceView, NULL );

the hr results in 16389 (with HRESULT_CODE(hr) )


according to msdn it should return one of the values on this list:

http://msdn.microsoft.com/en-us/library/ff476174(v=vs.85).aspx

and 16389 isnt on that list.




Im pretty sure DX11 can support old school TGA right? It works fine with dds, bmp, etc. Just the few TGAs i have tried do not. Any reasons why this wouldn't work?




Advertisement
D3DX11 doesn't support tga loading anymore, Microsoft removed it for some reason. However, it is an easy format to write your own loader for. http://en.wikipedia.org/wiki/Truevision_TGA gives you the file format. Either that, or you can convert/produce your textures in a format that D3DX11 does support.
or you can load it with FreeImage
here's a snippet how to do it
http://pastebin.com/40BV7vV0
don't mind e3d_Std it's just log functions
Crazy dude smoking D3D11, AngelScript, PhysX, 3D Sound, Network, DB, FBX, and some other weird things, doing that on Visual Studio 2010 + Visual Assist X on Overclocked CPU
PNG is more for photos with many colors but still my favourite format for textures in DirextX 11. It works great with GIMP because alpha filtering looks the same in the image editor and the game.

This topic is closed to new replies.

Advertisement