我需要將一些不斷變化的數據傳遞給我的像素着色器。我有一個texture2d,通過紋理參數傳遞給我的像素着色器。在我調用着色器之前,我需要更新紋理中的數據。如何在XNA 4.0中取消設置紋理數據
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
的問題是,當我這樣做,我得到一個例外:
「你可能不叫的SetData上的資源,同時正在積極的GraphicsDevice的設置取消它從設備調用SetData的前「。
如何「從設備中取消設置」?或者我應該在這裏採取不同的方法?
哪行觸發例外呢? –
調用.SetValue –