【发布时间】:2014-12-19 17:25:53
【问题描述】:
这是我从 Kinect 的 depthFrame 创建 Texture2D 的代码:
private short[] depthData;
private Texture2D depthTexture;
Color[] depthTextureData;
if (null == this.depthData || this.depthData.Length != frame.PixelDataLength)
{
this.depthData = new short[frame.PixelDataLength];
this.depthTexture = new Texture2D(
this.GraphicsDevice,
frame.Width,
frame.Height,
false,
SurfaceFormat.Bgra4444);
this.backBuffer = new RenderTarget2D(
this.GraphicsDevice,
frame.Width,
frame.Height,
false,
SurfaceFormat.Color,
DepthFormat.None,
this.GraphicsDevice.PresentationParameters.MultiSampleCount,
RenderTargetUsage.PreserveContents);
}
frame.CopyPixelDataTo(this.depthData);
depthTextureData = new Color[frame.Width * frame.Height];
depthTexture.GetData(depthTextureData);
我在depthTexture.GetData(depthTextureData); 收到一个错误,上面写着:
“System.ArgumentException”类型的未处理异常发生在 Microsoft.Xna.Framework.Graphics.dll 附加信息: 您在此方法中用于 T 的类型对此无效 资源。
有人知道是什么问题吗?
【问题讨论】: