I've been poking this all day and can't figure out for the life of me why this won't work. I have this shader:
texture myTexture;
sampler2D texSampler0 = sampler_state
{
Texture = <myTexture>;
};
float4 MyShader( float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 Color;
Color = tex2D( texSampler0, Tex.xy)*10;
return Color;
}
technique TestShader
{
pass p0
{
VertexShader = null;
PixelShader = compile ps_2_0 MyShader();
}
}
That is simply suppose to make everything a bit brighter. But the effect isn't doing squat. Here is my code. First I call begin scene, then begin effect, then draw the sprite, then end effect, then end scene. There are no errors when compiling or running. I'm setting the texture to the Texture of the sprite I'm rendering
public Renderer(Form renderForm)
{
...
_spriteEffect = Effect.FromFile(_device, "shader.fx", ShaderFlags.Debug);
_spriteEffect.Technique = "TestShader";
}
/// <summary>
/// Clears the buffers and begins the scene.
/// </summary>
public void BeginScene()
{
_device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0);
_device.BeginScene();
_sprite.Begin(SpriteFlags.AlphaBlend | SpriteFlags.DoNotSaveState);
}
public void beginEffect()
{
_spriteEffect.Begin(FX.None);
_spriteEffect.BeginPass(0);
}
public void endEffect()
{
_spriteEffect.EndPass();
_spriteEffect.End();
}
public void SetEffectTexture(Texture texture)
{
_spriteEffect.SetValue("myTexture", texture);
}
/// <summary>
/// Ends the scene then flips the buffers.
/// </summary>
public void EndScene()
{
_sprite.End();
_device.EndScene();
_device.Present();
}
Any and all help would be greatly appreciated.