【发布时间】:2019-05-13 02:58:04
【问题描述】:
我正在使用这张图片作为我的光罩:
但在游戏中边缘是可见的,如下所示:
我应该做些什么来阻止这种情况发生?是图像问题还是渲染方式有问题?我的代码如下所示:
frameBuffer.begin();
Gdx.gl.glClearColor(CLEAR, CLEAR, CLEAR * 2, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.setProjectionMatrix(camera.combined);
batch.setBlendFunction(GL20.GL_ONE, GL20.GL_ONE);
batch.begin();
// render lights
currentMap.lightsController.render(batch);
batch.end();
frameBuffer.end();
Gdx.gl.glClearColor(0, 0, 0, 1);
batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
// render map, entities, everything
currentMap.render(camera, batch);
batch.setProjectionMatrix(batch.getProjectionMatrix().idt());
batch.setBlendFunction(GL20.GL_ZERO, GL20.GL_SRC_COLOR);
batch.begin();
batch.draw(frameBuffer.getColorBufferTexture(), -1, 1, 2, -2);
batch.end();
【问题讨论】:
-
“边”是什么意思?屏幕截图中的那些点,或者您不喜欢渐变的显示方式?