I have been trying to get my shader code (HLSL) to draw a simple circle but after a day and a half I am getting nowhere. It seems people are using $$x^2 + y^2 = r^2$$ and remap texcoords but I only get a white quad.
struct VertexShaderStruct
{
float4 Position : POSITION0;
float2 Tex0 : TEXCOORD0;
};
VertexShaderStruct VertexShaderFunction(VertexShaderStruct input)
{
VertexShaderStruct output;
float4 worldPosition = mul(input.Position, World);
float4 viewPosition = mul(worldPosition, View);
output.Position = mul(viewPosition, Projection);
output.Tex0 = input.Tex0;
return output;
}
float4 PixelShaderFunction(VertexShaderStruct input) : COLOR0
{
float dx = 2 * input.Tex0.x - 1;
float dy = 2 * input.Tex0.y - 1;
float hyp = (dx * dx + dy * dy);
return (hyp == 1)? circleColor : otherColor;
}
I define circleColor as blue and otherColor as white, so it seems hyp==1
always fails.