title: Getting a texture output from GLSL shader to opengl
body: <p>I have a GLSL shader that compares two masks, and colours the pixel with the image of the highest value. I want to output that to a texture that stores at each pixel the highest mask for example 
  I have img1,img2,img3 and mask1,mask2,mask3 </p>
  
  <p>now the shader does the following </p>
  
  <pre><code>if mask1 &gt;= mask2
  gl_FragColor = img1
  else
  gl_FragColor = img2
  </code></pre>
  
  <p>So, if for the first pixel mask1 is highest, I would like to store in my output texture 0 and do that for each pixel </p>
  
  <p>then after finishing the shader execution I would like to have a texture in my opengl code that stores for each pixel either 0 or 1 which shows what mask has the larger value.</p>
  
  <p>Is there a possible way to do that ?</p>