title: Send a BOOL value to a Fragment Shader OpenGL ES 2.0 on iOS / iPhone
body: <p>I'm new to OpenGL ES 2.0 so please bear with me... I'd like to pass a BOOL flag into my fragment shader so that after a certain touch event has occurred in my app, it renders gl_FragColor differently. I tried using a vec2 attribute for this and just "faking" the .x value as my "BOOL" but it looks like OpenGL is normalizing the value from 0.0 to 1.0 before the shader gets ahold of it. So even though in my app I've set it to 0.0, while the shader is doing its thing, the value will eventually reach 1.0. Any suggestions would be hugely appreciated.</p>
  
  <p><strong>VertexAttrib Code:</strong></p>
  
  <pre><code>// set up context, shaders, use program etc.
  
  [filterProgram addAttribute:@"inputBrushMode"];
  inputBrushModeAttribute = [filterProgram attributeIndex:@"inputBrushMode"];
  
  bMode[0] = 0.0;
  bMode[1] = 0.0;
  
  glVertexAttribPointer(inputBrushModeAttribute, 2, GL_FLOAT, 0, 0, bMode);
  </code></pre>
  
  <p><strong>Current Vertex Shader Code:</strong></p>
  
  <pre><code>...
  attribute vec2 inputBrushMode;
  varying highp float brushMode;
  
  void main()
  {
      gl_Position = position;
      ...
      brushMode = inputBrushMode.x;
  }
  </code></pre>
  
  <p><strong>Current Fragment Shader Code:</strong></p>
  
  <pre><code>...
  varying highp float brushMode;
  
  void main()
  {
      if(brushMode &lt; 0.5) {
          // render the texture
          gl_FragColor = texture2D(inputImageTexture, textureCoordinate);
      } else {
          // cover things in yellow funk
          gl_FragColor = vec4(1,1,0,1);
      }
  }
  </code></pre>
  
  <p>Thanks in advance.</p>