Пример #1
0
    public Atlas1() {
      textureAtlas = new TextureAtlas("atlastest.png", 3);

      CCQuad2 texCoords[] =
          new CCQuad2[] {
            new CCQuad2(0.0f, 0.2f, 0.5f, 0.2f, 0.0f, 0.0f, 0.5f, 0.0f),
            new CCQuad2(0.2f, 0.6f, 0.6f, 0.6f, 0.2f, 0.2f, 0.6f, 0.2f),
            new CCQuad2(0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f),
          };

      CCQuad3 vertices[] =
          new CCQuad3[] {
            new CCQuad3(40, 40, 0, 120, 80, 0, 40, 160, 0, 160, 160, 0),
            new CCQuad3(240, 80, 0, 480, 80, 0, 180, 120, 0, 420, 120, 0),
            new CCQuad3(240, 140, 0, 360, 200, 0, 240, 250, 0, 360, 310, 0),
          };

      for (int i = 0; i < 3; i++) {
        textureAtlas.updateQuad(texCoords[i], vertices[i], i);
      }

      textureAtlas.removeQuad(2);
    }
Пример #2
0
    public void draw(GL10 gl) {
      gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
      gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);

      gl.glEnable(GL10.GL_TEXTURE_2D);

      textureAtlas.drawQuads(gl);

      //	textureAtlas_.draw(gl, 3);

      gl.glDisable(GL10.GL_TEXTURE_2D);

      gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
      gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
    }