LibGDX遮罩在android中的行为不正确

时间:2019-02-15 02:23:18

标签: java libgdx

因此,我尝试将圆形蒙版应用于小地图,它可在桌面应用程序上运行,但是当我在Android中运行它时,它就不行了。

这是我当前拥有的代码:

    Gdx.gl20.glColorMask(false, false, false, true);
    batch.setBlendFunction(GL20.GL_ONE, GL20.GL_ZERO);
    batch.draw(style.mask, getX(), getY(),width,height);
    batch.flush();
    Gdx.gl20.glColorMask(true, true, true, true);
    batch.setBlendFunction(GL20.GL_DST_ALPHA, GL20.GL_ONE_MINUS_DST_ALPHA);
    batch.draw(region,getX(),getY(),width,height);
    batch.flush(); 
    batch.setBlendFunction(GL20.GL_SRC_ALPHA,GL20.GL_ONE_MINUS_SRC_ALPHA); 

台式机:

enter image description here

Android:

enter image description here

面具:
enter image description here

1 个答案:

答案 0 :(得分:0)

下面的图片具有不同的遮罩效果以及它们的组合如何工作。这可能会对您有所帮助。

尝试一次。

enter image description here