0

I'm new in OpenGL world and I have question about performance and technique:

i have read followed post about performance,

seems like yo use the same texture multiple times leads to better performance.

Got it.

How can I do that in openGL?

[option 1]

use Sprite sheet let's say 3x3 like:

ここに画像の説明を入力

in this case i need cut off or shift it and show one after one, in canvas.drawBitmap i can use Rect

public void update() {  
    currentFrame = ++currentFrame % 3;
}

...

int srcX = currentFrame * width;

Rect  src = new Rect(srcX, 0, srcX+width, height);
Rect  dst = new Rect(x, y, x+width, y+height);
canvas.drawBitmap(b, src, dst, null);
..

[option 2]

Use 9 images and add all of them like:

for(int loop = 0; loop < 9; loop++){

  gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[loop]);
   ....
}

2番目のオプションは機能しますが、1番目のオプションが必要です。

助けてください、

ありがとうございました、

4

1 に答える 1

1

これは、描画しているスプライトシートの領域を効果的に指定する頂点のテクスチャ座標を更新することによって行います。あなたの前の質問に私が与えた答えは、基本的にすでにそれをカバーしています。

于 2013-07-17T03:51:45.190 に答える