问题
I have another LibGDX Problem (-_-). I have an black/white image like this:
Now I try to use this image as my background image in my 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();
(...)
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:
Your image is broken.
Try this:
Know that i changed path to
1.png
来源:https://stackoverflow.com/questions/46588036/libgdx-why-my-black-white-picture-gets-transparent