How to remove (cut-out) a transparent rectangle in a Texture, so that the hole will be translucent.
On Android I would use the Xfermodes approach:
https://stackoverflow.com/questions/8115732/how-to-use-masks-in-android
But in libgdx I will have to use opengl. So far I almost achieved what I was looking for, by using the the glBlendFunc From this nice and very helpful page I learend that
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
should solve my problem, but I tried it out, and it did not quite work as expected:
batch.end();
batch.begin();
batch.setBlendFunction(GL20.GL_ZERO,
GL20.GL_ONE_MINUS_SRC_ALPHA);
// Draw the background
super.draw(batch, x, y, width, height);
// draw the foreground
mask.draw(batch, x + innerButtonTable.getX(), y
+ innerButtonTable.getY(), innerButtonTable.getWidth(),
innerButtonTable.getHeight());
// result = {foreground}*{0,0,0,0} +
// {background}*(1-sourceAlpha)
batch.end();
batch.setBlendFunction(GL20.GL_SRC_ALPHA,
GL20.GL_ONE_MINUS_SRC_ALPHA);
batch.begin();
It is just making the mask area plain black, whereas I was expecting transparency, any ideas.
This is what I get:

This is what I expected:
