我制作动态壁纸,但有一个问题。我想将图像设置为背景和 Eclipse 显示错误:
01-10 10:37:18.206: E/AndroidRuntime(1045): FATAL EXCEPTION: GLThread 99
01-10 10:37:18.206: E/AndroidRuntime(1045): com.badlogic.gdx.utils.GdxRuntimeException: Texture width and height must be powers of two: 480x800
我的代码如下所示:
public class Tapeta implements ApplicationListener {
private SpriteBatch batch;
private Texture texture;
private TextureRegion region;
@Override
public void create() {
texture = new Texture(Gdx.files.internal("data/cat.jpg"));
Texture.setEnforcePotImages(false);
}
@Override
public void dispose() {
texture.dispose();
}
@Override
public void render() {
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(texture, 0, 0);
batch.end();
}
@Override
public void resize(int width, int height) {
}
@Override
public void pause() {
}
@Override
public void resume() {
}
}
我正在寻找我的问题的解决方案,但我没有找到。