Using texture as alpha mask to apply transparency

This Solved the problem.
– set GL version to 3.2. as hamoid suggested –
then the code below does what is expected.

mask.setImageType(OF_IMAGE_COLOR_ALPHA);
mask.getTexture().setSwizzle(GL_TEXTURE_SWIZZLE_A, GL_RED);
imgFront.getTexture().setAlphaMask(mask.getTexture());

The shader example from roymacdonald also has GL set to 3.2, (though there is a test in the example and uses different shaders depending upon GL Version)

good to know.
thanks!

Hi, I’m bumping this thread because I’m trying these methods on a Raspi and none of them work.

When I use the swizzle thing, it can’t find the constants, so I assume it is not on GLES. But the alpha methods don’t work either. Is there any limitation we should be aware of?

Thanks!

I realize now that there is no alphaMaskingShaderExample in the raspi repo. Maybe maybe I should take this as a bad sign :pensive: