【问题标题】:LibGDX - Scaled texture is repeating with Clamp to EdgeLibGDX - 使用 Clamp to Edge 重复缩放纹理
【发布时间】:2015-12-30 18:57:56
【问题描述】:

我正在使用以下纹理

它只是部分显示,当我使用以下代码时它会重复:

                    float scale = (float)( (float)Gdx.graphics.getWidth() / (float)(tex.getWidth()));
                    w = Gdx.graphics.getWidth();
                    h = scale * tex.getHeight();

                    float x = 0.0f;
                    float y = Gdx.graphics.getWidth() - h * splashTimer;

                    Sprite s = new Sprite(tex);
                    //s.setOriginCenter();


                    //  s.setScale(scale);
                    //s.setOriginCenter();
                    //  s.setOriginCenter();
                    //s.setSize(s.getWidth() * scale, s.getHeight() * scale);
                    //s.setOriginCenter();
                    s.setScale(0.1f);//1.0f + (1.0f - scale));

                    s.setOrigin(0, 0);
                    s.setPosition(x, y);

                    batch.begin();
                    batch.draw(s,0,0,Gdx.graphics.getWidth(), scale * s.getHeight());
                //  s.draw(batch);
                    batch.end();

它在 Android 中被切碎和重复,看起来像这样:

甚至没有绘制橙色。为什么会这样?

【问题讨论】:

    标签: java android libgdx sprite scale


    【解决方案1】:

    显然这是因为我使用了 mipmap。我禁用了 mipmap,现在它可以工作了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多