Hello,
I have following client-code:
protected override void LoadContent()
{
var colorMap = new Texture2D(GraphicsDevice, 10, 10, false, SurfaceFormat.Color);
Color[] arr = new Color[100];
for (int i = 0; i < arr.Length; i++)
arr[i] = Color.Blue;
colorMap.SetData<Color>(arr);
}
I then “upload” this texture2d-object to the graphics card:
mEffect.Parameters["colorMap"].SetValue(colorMap);
_spriteBatch.Begin(effect: mEffect);
_spriteBatch.Draw(mBackbuffer, new Vector2(0, 0), Color.Red);
_spriteBatch.End();
My hlsl-shader looks like this:
Texture2D colorMap;
float4 MainPS(VertexShaderOutput input) : COLOR
{
float4 color = colorMap[uint2(0, 0)];
return float4(color.xyz, 1);
}
What I try to do is access the set pixels of the texure2d like a 2d-array, in order to do this I use the []-Operator of the Texture2D object, but for some reason I dont get any results at all, what am I doing wrong?
I use ps_5_0
…
Best regards