【发布时间】:2015-11-10 13:49:38
【问题描述】:
我正在尝试遮盖比遮罩小的背景图像。背景和蒙版之间的空间显示为黑色。
这是我正在使用的代码:
batch.end();
batch.begin();
Gdx.gl20.glColorMask(false, false, false, true);
batch.setBlendFunction(GL20.GL_ONE, GL20.GL_ZERO);
batch.draw(mask, getX(), getY());
batch.flush();
Gdx.gl20.glColorMask(true, true, true, true);
batch.setBlendFunction(GL20.GL_DST_ALPHA, GL20.GL_ONE_MINUS_DST_ALPHA);
batch.draw(texture, getX(), getY());
batch.flush();
batch.setBlendFunction(GL20.GL_SRC_ALPHA,GL20.GL_ONE_MINUS_SRC_ALPHA);
batch.end();
batch.begin();
我尝试了所有类型的功能组合,但没有成功。可能我错过了一些东西。
更新
附上我构建的 src 和 dst 混合函数的所有可能(相关)结果的图表。幸运的是,以下方法都不起作用,而且我猜还需要做更多的事情才能达到结果。
Gdx.gl20.glColorMask(true, true, true, true);
batch.setBlendFunction(src_func, dst_func);
batch.draw(texture, getX(), getY());
【问题讨论】:
-
这是一个非常详细且内容丰富的问题。