@kriswd40 wrote:
I'm trying to make the same scanline shader that is talked about in this tutorial: http://joshuasmyth.maglevstudios.com
My code is almost what is in that tutorial with a slight update changing ps_2_0 to ps_4_0_level_9_1. Also the formatting on this site screws up the "Texture = ;" line by removing Texture surrounded by greater than and less than signs.
// Shader:
texture Texture;
sampler TextureSampler = sampler_state
{
Texture = ;
};float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
// Return normal
float4 color = tex2D(TextureSampler, input.TextureCordinate);
return color;
}int ImageHeight;
float4 ScanLine(VertexShaderOutput input) : COLOR0
{
float4 color = tex2D(TextureSampler, input.TextureCordinate);int a = saturate((input.Position.y * ImageHeight) % 4); int b = saturate((input.Position.y * ImageHeight + 1) % 4); float m = min(a,b); color.rgb *= m; return color;
}
.// Game1.cs
Program.SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
Program.m_Effect.Parameters["ImageHeight"].SetValue(720);
Program.m_Effect.CurrentTechnique = Program.m_Effect.Techniques[1];
Program.m_Effect.CurrentTechnique.Passes[0].Apply();GraphicsDevice.Clear(Color.Black);
Program.SpriteBatch.Draw(this.gameTexture2, SetResolutionHelper.DestinationRectangle, Color.White);Program.SpriteBatch.End();
When I run the PixelShaderFunction() shader, it correctly displays the current picture to the screen (this was just for testing purposes).
When I run the ScanLine() shader, it just draws a black screen.
Any ideas? Any tips on how I can debug this, as it doesn't stop on any breakpoints for me?
Thanks,
Kris
Posts: 9
Participants: 3