title: GLSL - Passing coordinates to fragment shader?
body: <p>I have the following shaders</p>
  
  <p>VertexShader</p>
  
  <pre><code>#version 330
  layout (location = 0) in vec3 inPosition;
  layout (location = 1) in vec4 inColour;
  layout (location = 2) in vec2 inTex;
  layout (location = 3) in vec3 inNorm;
  uniform mat4 transformationMatrix;
  uniform mat4 projectionMatrix;
  out vec4 ShadowCoord;
  void main()
  {
    gl_Position = projectionMatrix * transformationMatrix * vec4(inPosition, 1.0);
    ShadowCoord = gl_Position;
  }
  </code></pre>
  
  <p>FragmentShader</p>
  
  <pre><code>#version 330
  in vec4 ShadowCoord;
  out vec4 FragColor;
  uniform sampler2D heightmapTexture;
  void main()
  {
    FragColor =  vec4(vec3(clamp(ShadowCoord.x/500,0.0,1.0),clamp(gl_FragCoord.y/500,0.0,1.0),0.0),1.0);
  }
  </code></pre>
  
  <p>What I would expect this to do is to draw the scene, with green in the top left, yellow in the top right, red in the bottom right and black in the bottom left.  Indeed this is what happens when I replace <code>ShadowCoord.x</code> with <code>gl_FragCoord.x</code> in my fragment shader.  Why then, do I only get a vertical gradient of green?  Evidently something screwy is happening to my ShadowCoord.  Anyone know what it is?</p>