title: world position to screen position in fragment shader glsl
body: <p>I have a WebGL renderer and I want to transform random world coordinates to screen coordinates in the fragment shaders.</p>
  
  <p>That will allow me to compare the "computed screen coordinates" to the current fragment screen coordinates.</p>
  
  <p>I have all the information needed to do so I believe, just not sure which is the right way to do so.</p>
  
  <pre><code>  ...
    // available information:
  
    // uCanvasWidth (float)
    // uCanvasHeight (float)
    // modelMatrix (mat4)
    // modelViewMatrix (mat4)
    // projectionMatrix (mat4)
    vec4 someWorldCoordinates = vec4(1., 2., 3., 1.);
    // map it to screen coordinates?
    vec4 screenCoordinates = ???
  
    // compare to current fragment location
    if(screenCoordinates.x &gt; gl_FragCoord.x){
      // do stuff
    }
    ...
  </code></pre>