title: raycasting: how to properly apply a projection matrix?
body: <p>I am currently working on some raycasting in GLSL which works fine. Anyways I want to go from orthogonal projection to perspective projection now but I am not sure how to properly do so. 
  Are there any good links on how to use a projection Matrix with raycasting?
  I am not even sure what I have to apply the matrix to (propably to the ray direction somehow?). Right now I do it like this (pseudocode):</p>
  
  <pre><code>vec3 rayDir = (0.0, 0.0, -1.0); //down the negative -z axis in parallel;
  </code></pre>
  
  <p>but now I would like to use a projMatrix which works similar to gluPerspective function so that I can simply define an aspect ratio, fov and near and far plane.
  So basically, can anybody provide me a chunk of code to set up a proj matrix similar to <code>gluProjection</code> does?
  And secondly tell me if it is correct to multiply it with the rayDirection?</p>