title: Using gl_FragCoord to create a hole in a quad
body: <p>I am learning WebGL, and would like to do the following:</p>
  
  <p>Create a 3D quad with a square hole in it using a fragment shader. </p>
  
  <p>It looks like I need to set <code>gl_FragColor</code> based on <code>gl_FragCoord</code> appropriately. </p>
  
  <p>So should I:</p>
  
  <p>a) Convert <code>gl_FragCoord</code> from window coordinates to model coordinates, do the appropriate geometry check, and set color. </p>
  
  <p>OR</p>
  
  <p>b) Somehow pass the hole information from the vertex shader to the fragment shader. Maybe use a texture coordinate. I am not clear on this part.</p>
  
  <p>I am fuzzy about implementing either of the above, so I'd appreaciate some coding hints on  either. </p>
  
  <p>My background is that of an OpenGL old timer who has not kept up with the new shading language paradigm, and is now trying to catch up...</p>
  
  <p>Edit (27/03/2011):</p>
  
  <p>I have been able to successfully implement the above based on the tex coord hint. I've written up this example at the link below:</p>
  
  <p><a href="http://tat-tvam-asi.in/programming/webgl/quads-with-holes/" rel="nofollow noreferrer">Quads with holes - example</a></p>
  
  <p><img src="https://i.stack.imgur.com/9aEJX.jpg" alt="Quads with holes - example"></p>