I am rendering a fullscreen quad using XNA. I am having an issue where the top pixel line and left pixel line are not rendered. It should be black in the picture. Can anyone tell me why this might be happening?
The effect's intent is to fade the screen out or in by adjusting the alpha of the pixel.
HLSL
float3 c;
float a;
float4 ShadeVertex(float3 pos : POSITION0) : POSITION0
{
return float4(pos, 1);
}
float4 ShadePixel(float2 p : VPOS) : COLOR0
{
return float4(c, a);
}
technique Simple
{
pass FirstPass
{
VertexShader = compile vs_3_0 ShadeVertex();
PixelShader = compile ps_3_0 ShadePixel();
}
}
QuadRenderer.cs
internal sealed class QuadRenderer : GameComponent
{
#region fields
private VertexPositionTexture[] triangles;
private short[] indexData = new short[] { 0, 1, 2, 2, 3, 0 };
private GraphicsDevice gfx;
#endregion
#region constructors
public QuadRenderer(IGameEngine engine)
: base(engine)
{
this.gfx = engine.Device.Graphics;
// texture coordinates semantic not used or needed
this.triangles = new VertexPositionTexture[]
{
new VertexPositionTexture(new Vector3(1, -1, 0),
Vector2.Zero),
new VertexPositionTexture(new Vector3(-1, -1, 0),
Vector2.Zero),
new VertexPositionTexture(new Vector3(-1, 1, 0),
Vector2.Zero),
new VertexPositionTexture(new Vector3(1, 1, 0),
Vector2.Zero)
};
}
#endregion
#region methods
public void Render(Effect effect)
{
foreach (EffectPass p in effect.CurrentTechnique.Passes)
p.Apply();
this.Render();
}
private void Render()
{
this.gfx.DrawUserIndexedPrimitives(PrimitiveType.TriangleList,
this.triangles, 0, 4,
this.indexData, 0, 2);
}
#endregion
}