title: OpenGL Texture Combiner - gradient texture
body: <p>I've got 2 RGBA8 textures:</p>
  
  <p>A) The "main" texture with data for display in all channels</p>
  
  <p>B) The "gradient" texture that only has meaningful data in alpha (of course this should really just be an A8 texture)</p>
  
  <p>Using OpenGLES 1.1 texture combiners, I'd like the resulting texel to copy RGB from texture #A, and use an alpha modulated from both textures (alpha from texture A * alpha from texture B).</p>
  
  <p>I'm having trouble with my texture combiner code (I already tried monkeying with it) and was wondering if anyone can spot the problem:</p>
  
  <pre><code>glActiveTexture(GL_TEXTURE0);
  glBindTexture(GL_TEXTURE_2D, geometryP-&gt;texName);
  glTexCoordPointer(2, GL_BYTE, 0, geometryP-&gt;texCoordsP);
  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
  
  glActiveTexture(GL_TEXTURE1);
  glBindTexture(GL_TEXTURE_2D, mGradientTextureName);
  glTexCoordPointer(2, GL_BYTE, 0, geometryP-&gt;texCoordsP);
  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
  
  glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
  glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PREVIOUS);
  glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_TEXTURE);
  glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
  glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
  
  glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
  glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE);
  glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_TEXTURE);
  glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
  glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
  </code></pre>
  
  <p>The result I get basically just looks like RGBA from texture #A (the main texture).</p>