I'm creating a shader for vehicle headlights and I want to alter the alpha value of each fragment based on it's distance from the origin. I have defined the origin as a point using an uniform vec3. When I attempt to calculate the distance, it seems that I am only getting 2d coordinates from the framebuffer.
I'm transforming the point here, in the vertex shader:
Code :lposit = vec3( gl_ModelViewProjectionMatrix * vec4(posit, 1.0) );
I'm attempting to use the transformed point here, in my fragment shader.
Code :float dist = distance( lposit, gl_FragCoord.xyz);
It seems that I'm not getting the expected results from glFragCoord. Thanks.