float2 ViewportSize; // Width and height of viewport window float4x4 TransformMatrix; // Used to transform vertices if necessary // Applies a transformation matrix, converts from screen space to clip space void LineVertexShader( inout float4 position: POSITION, inout float4 color : COLOR0 ) { // Apply transformation matrix (translations, scaling, rotations) position = mul(position, TransformMatrix); // Viewport adjustment. position.xy /= ViewportSize; position.xy *= float2(2, -2); position.xy -= float2(1, -1); } // Simply returns the color of the pixel float4 LinePixelShader(float4 color : COLOR0) : COLOR { return color; } technique RenderLines { pass P0 { VertexShader = compile vs_1_1 LineVertexShader(); PixelShader = compile ps_1_1 LinePixelShader(); } }