2011-12-27 193 views
1

我想了解下面的代碼從andengine加載紋理,我想知道什麼是512 n 512(我知道它的高度和寬度),但尺寸爲480 * 320的圖像。瞭解andengine紋理加載

public void onLoadResources() { 
    this.mTexture = new Texture(512, 512, 
      TextureOptions.BILINEAR_PREMULTIPLYALPHA); 
    this.mSplashTextureRegion = TextureRegionFactory 
      .createFromAsset(this.mTexture,this, "image.png", 0, 0); 
    this.mEngine.getTextureManager().loadTexture(this.mTexture); 
} 

我在網上搜索,但沒有預期的解釋。

回答

2

我不太瞭解AndEngine,但這可能是因爲很多庫都假設圖像尺寸是兩個冪。

在這裏您可以找到更好的解釋: About power of 2 rule

+0

謝謝jDourlens,我不知道這個規則。 :) – Yogesh 2011-12-27 14:46:07

+0

我知道在PSP上編程時這真的很難;) – jDourlens 2011-12-27 14:53:44