예제 #1
0
 private void update() {
   if (subImages != null) {
     return;
   }
   target.loadTexture();
   int tilesAcross = ((width - (margin * 2) - tw) / (tw + spacing)) + 1;
   int tilesDown = ((height - (margin * 2) - th) / (th + spacing)) + 1;
   if ((height - th) % (th + spacing) != 0) {
     tilesDown++;
   }
   subImages = new LTexture[tilesAcross][tilesDown];
   for (int x = 0; x < tilesAcross; x++) {
     for (int y = 0; y < tilesDown; y++) {
       subImages[x][y] = getImage(x, y);
     }
   }
 }
예제 #2
0
 public synchronized void update() {
   if (isClose) {
     return;
   }
   if (texture == null) {
     texture = new LTexture(width, height, hasAlpha);
   }
   if (!texture.isLoaded()) {
     texture.loadTexture();
     GLEx.gl10.glBindTexture(GL.GL_TEXTURE_2D, texture.getTextureID());
     GLEx.gl10.glTexSubImage2D(
         GL.GL_TEXTURE_2D, 0, 0, 0, width, height, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, buffer);
     GLEx.gl10.glBindTexture(GL.GL_TEXTURE_2D, 0);
   } else {
     if (isUpdate) {
       GLEx.gl10.glBindTexture(GL.GL_TEXTURE_2D, texture.getTextureID());
       GLEx.gl10.glTexSubImage2D(
           GL.GL_TEXTURE_2D, 0, 0, 0, width, height, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, buffer);
       GLEx.gl10.glBindTexture(GL.GL_TEXTURE_2D, 0);
       isUpdate = false;
     }
   }
 }