I wanna render an image to a texture taking advantage of DirectX acceleration. But instead of showing that image on the screen, I wanna get this image back to the regular memory as a bitmap to do anything with the result. How do I transfer some texture to the regular memory? I am using DirectX 11.
-
1You can find the same problem, and the solution, here. You only need to use DirectX 11 version instead of 10.enigma– enigma2012-12-12 15:09:04 +00:00Commented Dec 12, 2012 at 15:09
-
almost there... In fact I want to have ACCESS to the pixels. D3DX10SaveTextureToFile() does it in background of course. But I wanna know how to do it by myself. I think it's something related to Map/Unmap of resources(DX10/DX11), but I couldn't find anything that really works! :-(Wagner Patriota– Wagner Patriota2012-12-17 20:49:13 +00:00Commented Dec 17, 2012 at 20:49
Add a comment
|
1 Answer
You can use a seperate "staging" texture which has cpu read access. Than copy your rendertarget texture to this staging texture with CopySubresource() or CopyResource() an perform Map() to this staging texture.
--> http://msdn.microsoft.com/en-us/library/windows/desktop/ff476259(v=vs.85).aspx
2 Comments
sandicz
Oh, I saw that's the solution in the comments above... I used this several times and it works. Whats your problem with Map/Unmap?
Dimitri Podborski
Any suggestions on how to do it in DirectX 12? It seems that many memory related things have changed there :(