Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

.setAlphaMask and Shaders

$
0
0

@Miles wrote:

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

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles