I am currently learning the language "HLSL" for effect files to my XNA game. However; I have ran into the issue of applying the effects to my SpriteBatch.
My effect file looks like this, and makes the rendered texture, white. :]
float4 PSFunction(float2 coord : TEXCOORD0) : COLOR0
{
return float4(0, 0, 0, 1); // Return a white pixel
}
technique Sample
{
pass pass0
{
PixelShader = compile ps_2_0 PSFunction();
}
}
It is working as it should, when I begin my SpriteBatch with following arguments:
SpriteBatch.Begin(0, null, null, null, null, SampleEffect);
However; the SpriteBatch.Begin method does not accept multiple effects. Therefore I tried to do
SampleEffect.CurrentTechnique.Passes[0].Apply();
before calling
SpriteBatch.Begin();
But nothing happend, therefore I tried couple of diffrend methods. Such as
SampleEffect.CurrentTechnique.Passes["pass0"].Apply();
But it still did not work. So I verified the effect was attached to the correct GraphicsDevice using the object.ReferenceEquals function, but it was equaled to the correct graphicsDevice. What am I doing wrong? How would I attach multiple effects to my SpriteBatch?
Thanks in Advance, Rasmus :]