title: How to determine even/odd line of a texture in GLSL ES
body: <p>I need to remove all odd lines from a texture - this is part of a simple deinterlacer.</p>
  
  <p>In the following code sample, instead of getting the RGB from texture, I choose to output white colour for odd line and red colour for even line - so I can visually check if the result is what I expected.</p>
  
  <p>_texcoord is passed in from vertex shader and has a range of [0, 1] for both x and y</p>
  
  <pre><code>uniform sampler2D sampler0; /* not used here because we directly output White or Red color */
  varying highp vec2 _texcoord;
  void main() {
      highp float height = 480.0; /* assume texture has height of 480 */
      highp float y = height * _texcoord.y;
      if (mod(y, 2.0) &gt;= 1.0) {
          gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); 
      } else {
          gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0); 
      }
  }
  </code></pre>
  
  <p>When render to screen, the output isn't expected. Vertically it's RRWWWRRWWW But I am really expecting RWRWRWRW (i.e. alternate between red and white color)</p>
  
  <p>My code run on iOS and target to GLES 2.0 so it should be no different on Android with GLES 2.0</p>
  
  <p>Question: Where did I do wrong? </p>
  
  <p>EDIT</p>
  
  <ol>
  <li>Yes the texture height is correct</li>
  <li>I guess my question is: given a _texcoord.y, how to tell if it's referring to odd or even line of the texture. </li>
  </ol>