【发布时间】:2011-11-16 16:08:05
【问题描述】:
我需要将一些不断变化的数据传递给我的像素着色器。我有一个通过纹理参数传递给我的像素着色器的 texture2d。在调用着色器之前,我需要更新纹理中的数据。
emittingPositions.SetData(emittingPositionsBuffer); //Set the data on the texture
animationEffect.Parameters["emittersMap"].SetValue(emittingPositions); //Tell the shader about the texture data
//go on to do the actual drawing calls to use the pixel shader
问题是当我这样做时会出现异常:
“当资源在 GraphicsDevice 上主动设置时,您不能在资源上调用 SetData。在调用 SetData 之前从设备取消设置它。”
如何“从设备中取消设置”?还是我应该在这里采取不同的方法?
【问题讨论】:
-
哪一行触发了异常?
-
第二行调用.SetValue
标签: xna-4.0 pixel-shader