I have two textures: One is a usual RGBA semi-transparent texture showing an image which is rendered as usual.
The second texture has just one channel (float, values in inverval [0,1]). I want to implement something like a cut-tool or a “rubber”-tool. The second texture shall now act as additional alpha-mask for the first one: If the second texture is zero, also the first texture shall become invisible. And vice versa, if the second texture is one, the first shall be visible (but not ignore the alpha value of the first one).
Can I realise this using glBlendfunc?
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBindTexture(GL_TEXTURE_2D, uint_image_texture); // render the texture // ... glBlendFunc(???,???); glBindTexture(GL_TEXTURE_2D, unit_masking_texture); // overlay the cut-texture // ...
Thanks in advance,