title: function to compute orthogonal projection matrix
body: <p>I was given a code of shaders (vertex and fragment) and my goal is to add some functionality into. But I'm having a trouble to understand some functions and Math inside. I have an image I want to project the texture of this image onto the cylinder. This is how I'm getting pixels from texture:</p>
  
  <pre><code>float hFOV=0.0789;      // orizontal field of view
  float aspectRatio=1.5;  
  float ax = tan(hFOV * M_PI);
  float ay = ax / aspectRatio;
  vec4 q1 = myW2N(ax,ay,1.,6.) * vec4(d, 1.); // ??    
  vec2 p = q1.xy / q1.w;
  p = 0.5 * (p + 1.0);
  vec4 c = texture2D(foto, p);
  </code></pre>
  
  <p>But what makes me a headache is <code>myW2N()</code> function, I can't go through the idea inside and what the result means. Its just my opinion that this creates projection matrix.. To show you body of this function:</p>
  
  <pre><code>mat4 myW2N(float ax, float ay, float zNear, float zFar) {
      float cx = 1.0 / ax;
      float cy = 1.0 / ay;
      float z0 = -zNear;
      float z1 = -zFar;
      float az = (z0 + z1) / (z0 - z1);
      float bz = (1. - az) * z0;
      return mat4(
          cx, 0., 0., 0.,
          0., cy, 0., 0.,
          0., 0., az, bz,
          0., 0., -1., 0.
          );
      }
  </code></pre>
  
  <p>Can anybody tell me what <code>zNeat and zFar</code> represent there? I tried to put there some values and it changes shape of wraped image, but what is weird it somehow works even if <code>zNear</code> is bigger that <code>zFar</code>..</p>
  
  <p>Could you give me a clue what this function means and what it does in the end, please?</p>