.setAlphaMask and Shaders

ayop!

i am trying to alphamask an image and then pass that through a shader, but the alphamask appears to stop the shader from working, here’s my code:

for (int i=0; i<slices.size(); i++) {
    slices[i].img.bind();
    shader.begin();
    shader.setUniform4f( "color1", mGradientColors[2]);//can do this to make it static: slices[i].col1
    shader.setUniform4f( "color2", mGradientColors[3]);
    shader.setUniformTexture("sourceTex", slices[i].img.getTexture(), 0);
    slices[i].img.getTexture().setAlphaMask(alphaMask.getTexture());
    slices[i].img.update();
    slices[i].img.getTexture().draw(slices[i].centre);
    shader.end();
    slices[i].img.unbind();
}

This shows an unaffected but alphaMasked image, however if I remove the .setAlphaMask() then the shader works as expected. Anybody have any hints as to what might be going on here?
Thanks

if you are in GL ES or using the programmable renderer, which i think you are since your previous post was on iOS, then yes cause the alpha mask is done through a shader if i remember well so binding another will cancel the mask

Ahhhh I seee, thanks for clearing that up for me :grinning:
So should I render the slices with the alpha mask as fbos, then use them within the shader? Would that make the alpha masked slices effectively permanent?
Thanks!!

yes i guess that should work

Thanks again Artruro. As always the voice of sage wisdom :slight_smile: