Search code examples
opengl-esopengl-es-2.0glblendfunc

OpenGL ES 2.0 blending alpha limit


Is there a blending method in OpenGL ES 2.0 for setting a limit on the blended alpha value? I want to achieve an effect where textures get blended normally when drawn on top of each other, until an alpha limit is reached, at which point the blended alpha value would stop increasing.


Solution

  • I was able to achieve this effect using:

    glBlendColor(0, 0, 0, 1-myLimit);
    glBlendFunc(GL_ONE_MINUS_CONSTANT_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    

    Seems to achieve the desired effect.