本文介绍了LibGDX:为什么我的黑白图片变得透明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我还有另一个LibGDX问题(-_-).我有这样的黑白图像:
I have another LibGDX Problem (-_-). I have an black/white image like this:
现在,我尝试在PlayScreen中将此图片用作背景图片:
Now I try to use this image as my background image in my PlayScreen:
PlayScreen类:
Class PlayScreen:
(...) Texture background; (...) background = new Texture("grid.jpg"); (...) gameHandler.getBatch().begin(); gameHandler.getBatch().draw(background,0,0,Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); gameHandler.getBatch().end(); (...)GameHandler类:
class GameHandler:
(...) Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); this.getScreen().render(Gdx.graphics.getDeltaTime()); (...)使用此代码,我会遵循(错误的比例是因为视口,但这没关系):
Using this code I get following(wrong scale is because viewport, but that doesn´t matter):
如何保留真实图像的颜色?
How can I keep the colors of the real image?
希望您能帮助我! 〜亨利
Hope you can help me! ~Henri
推荐答案您的图像已损坏.
尝试一下:
知道我将路径更改为
1.png更多推荐
LibGDX:为什么我的黑白图片变得透明?
发布评论