What I'm trying to do is output a masked texture on an iPhone using OpenGL ES 1.1. The default combining behavior seems to work to my advantage until I actually want to vary the ALPHA of the final result!
The 'a' (Alpha) float variable has no effect here: (Everything else outputs fine, it's masked and drawing nicely aside from the alpha being uncontrollably 1.0 Opaque)
/* Setup First Texture (RGBA Texture) */
glClientActiveTexture(GL_TEXTURE0);
glActiveTexture(GL_TEXTURE0);
glColor4f(r, g, b, a);
glBindTexture(GL_TEXTURE_2D, t->tx);
glVertexPointer(2, GL_FLOAT, 0, afPos);
glTexCoordPointer(2, GL_FLOAT, 0, afUV);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
/* Setup Mask (RGBA Texture, White to Transparent Gradient) */
glClientActiveTexture(GL_TEXTURE1);
glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
glColor4f(r, g, b, a);
glBindTexture(GL_TEXTURE_2D, tMask->tx);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, afPos);
glTexCoordPointer(2, GL_FLOAT, 0, afUV);
/* Make the Mask Repeat */
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
/* Draw Both */
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
[edit]The entire color has no effect at all, it's as if it's set to (1, 1, 1, 1) so it's not just the alpha.[/edit]
Think of it as if you have a masked layer in photoshop which appears correct, now all I want to do is set that layers opacity. I appreciate your help!