I want to know how the glBlendFunc works. For example, i have 2 gl textures, where the alpha is on tex1, i want to have alpha in my final image. Where the color is on tex1, i want the color from tex2 to be.
glBlendFunc applies only to how the final color fragment gets blended with the frame buffer. I think what you want is multitexturing, to combine the two textures by blending the texture stages using glTexEnv, or using a fragment shader to combine the the two textures.
Sorry, can't do this with simple blending. We for instance used to do the same thing using frament shaders.
Seconding the shaders. If you can use a shader its much easier to just do what you want with the data rather than messing with arcane blending functions.
Sadly, this is for openGL ES on the iPhone, so no shaders, but point taken. My problem was a very simplified version of the questions, i needed to apply a simple color ( incl alpha ), to a part of a defined texture. As Lee pointed out, texture blending is to allow alpha to show up on the framebuffer. The solution was to insist that the artist makes the "action bit" of the texture white, and then assigning a color to the vertices that i render. Something like this.
glTexCoordPointer( 2, GL_FLOAT, 0, sprite->GetTexBuffer() );
glVertexPointer( 3, GL_FLOAT, 0, sprite->GetVertexBuffer() );
glColorPointer( 4, GL_FLOAT, 0, sprite->GetColorBuffer() );
glDrawArrays( GL_TRIANGLES, 0, 6 ); // Draw 2 triangles
Where even tho it has a texture, having the color means it adds to the texture's color, so where it's an alpha, it remains alpha, and where it is white ( as i had to make it ), it becomes the color of the color pointer at the point.