0

私はandengineを使用してゲームを開発しています..AutoParallaxBackgroundを使用して背景画像を移動しています..正常に動作しています..しかし、画像の間に空白行があります..画像に問題はありません

ie: autoParallaxBackground.addParallaxEntity(new ParallaxEntity(-20.0f, new Sprite(0, 0, this.bgTextureRegion1)));

この問題を解決するには?

ここに画像の説明を入力

デバイスのスクリーン ショット... 左隅に空白行が表示されます

画像サイズ: 720x480 カメラ サイズ: 720x480 モバイル画面サイズ: 320x240

4

3 に答える 3

3

この問題は、バイリニア フィルタリングが適用されると、TextureAtlas の黒い背景が画像ににじみ出るために発生します。解決策は、ブリードオーバーが正しい色になるように、左端と右端の 1px ラインを 2 倍にすることです。これが本当に問題であることを証明する厄介な修正がありますが、バックグラウンドをロードするのに必要な時間が 3 倍になるため、プロダクション コードには役に立ちません。背景用の TextureAtlas を作成するときは、次のようにします。

BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.backgroundBitmapTexture, this, "background.png", 0, 0);
BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.backgroundBitmapTexture, this, "background.png", 2, 0);
this.backgroundTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.backgroundBitmapTexture, this, "background.png", 1, 0);

これが行うことは、テクスチャを 3 回ロードすることです。最初の 2 回は左右に 1 ピクセルずつシフトします。3 番目の呼び出しは、2 つの間に実際のテクスチャ領域を作成します。

于 2012-09-27T09:08:16.403 に答える
0

バックグラウンド スプライトに preDraw() メソッドを実装し、pGLState.enableDither(); を設定します。

new Sprite(0, CAMERA_HIGHT,
                    this.mParallaxLayerBack, vertexBufferObjectManager) {

                @Override
                protected void preDraw(GLState pGLState, Camera pCamera) {

                    super.preDraw(pGLState, pCamera);
                    pGLState.enableDither();
                }

            }
于 2014-11-20T12:31:50.137 に答える