title: Culling lines and points based on "normals"
body: <p>I'm trying to simulate things like <code>glPolygonMode( GL_BACK, GL_LINE)</code> in WebGL.  I can draw with mode <code>LINES</code> instead of <code>TRIANGLES</code>, but I can't see how WebGL could automatically determine whether a particular segment is back-facing, because segments don't face anywhere.</p>
  
  <p>To solve this, I pass the normal of the original triangle to the shader.  It's easy to calculate transforms of this under the usual modelview transformations (rotations, scaling, translations); then I just multiply the normal by the transpose of the inverse. Based on whether the normal points into the screen or out I can decide whether to cull a line segment.</p>
  
  <p>However, this isn't quite right.  I need the inverse of the projection matrix as well to take perspective distortions into account.</p>
  
  <p>I'm using the <code>CanvasMatrix4.frustum()</code> or <code>CanvasMatrix4.ortho()</code> functions to get the projection matrix.  Are there formulas or functions available for their inverses?</p>
  
  <p>Alternatively, is there a better way to simulate things like <code>glPolygonMode( GL_BACK, GL_LINE)</code>?</p>