开发者

Accessing the data in a SlimDX Texture2D object

How do I access the data in a Texture2D object? Lots of XNA posts suggest using the function Texture2D.GetData but that appears to be missing in the SlimDX version of a Texture2D. I need to process my image to calculate overall luminance of the scene and don't want to be running 300 accesses in a pixel shader (i.e. 300 access * num_pixels per frame) when I could be doing it once per frame.

All I need to be able to do is access the colour (R32G32B32A32) of the texture.

Ah I reckon I've found it thanks to the SlimDX SDK. The Texture2D.ToStream() method sends t开发者_JAVA百科he texture data to a memory stream, then I simply have to parse the bytes to get at my data. I'll submit this as an answer if it works for me.


Yep, ToStream() works fine, thanks to the SlimDX SDK. The Texture2D.ToStream() method sends the texture data to a memory stream, then I simply have to parse the bytes to get at my data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜