public void onLoad(GL10 gl, QuickTiGame2dGameView view) {
    if (loaded) return;

    this.view = view;

    // load particle setting from Particle Designer XML
    loadParticleXML();

    if (gzipBase64Data != null && gzipBase64Data.length() > 0) {
      view.loadTexture(gl, image, gzipBase64Data);
      gzipBase64Data = "";
    }

    QuickTiGame2dTexture aTexture = view.getTextureFromCache(image);

    // if texture is not yet cached, try to load texture here
    if (aTexture == null && image != null) {
      view.loadTexture(gl, image);
      aTexture = view.getTextureFromCache(image);
    }

    if (aTexture != null) {
      hasTexture = true;

      if (width == 0) width = aTexture.getWidth();
      if (height == 0) height = aTexture.getHeight();
    }

    createTextureBuffer(gl);
    createQuadBuffer(gl);

    if (hasTexture && !aTexture.isSnapshot()) view.onLoadSprite(this);
    if (debug) GLHelper.checkError(gl);

    loaded = true;
  }
  private void createQuadBuffer(GL10 gl10) {

    GL11 gl = (GL11) gl10;

    //
    // quad = ([vertex x, vertex y, texture x, texture y, red, green, blue, alpha] * 4) = 8 * 4 *
    // (float=4bytes) = 128 bytes
    //
    quads = new float[32 * maxParticles];
    indices = new short[maxParticles * 6];
    particles = new Particle[maxParticles];

    for (int i = 0; i < maxParticles; i++) {
      indices[i * 6 + 0] = (short) (i * 4 + 0);
      indices[i * 6 + 1] = (short) (i * 4 + 1);
      indices[i * 6 + 2] = (short) (i * 4 + 2);

      indices[i * 6 + 3] = (short) (i * 4 + 2);
      indices[i * 6 + 4] = (short) (i * 4 + 3);
      indices[i * 6 + 5] = (short) (i * 4 + 0);
    }

    // initialize texture.x, texture.y
    for (int i = 0; i < maxParticles; i++) {
      int vi = i * 32;

      quads[vi + 0] = 0; // vertex  x
      quads[vi + 1] = 0; // vertex  y

      quads[vi + 2] = 0 + getTexelHalfX(); // texture x
      quads[vi + 3] = getTexture().getMaxT() + getTexelHalfY(); // texture y

      quads[vi + 4] = 0; // red
      quads[vi + 5] = 0; // green
      quads[vi + 6] = 0; // blue
      quads[vi + 7] = 0; // alpha

      // -----------------------------
      quads[vi + 8] = 0; // vertex  x
      quads[vi + 9] = 1; // vertex  y

      quads[vi + 10] = 0 + getTexelHalfX();
      quads[vi + 11] = 0 - getTexelHalfY();

      quads[vi + 12] = 0; // red
      quads[vi + 13] = 0; // green
      quads[vi + 14] = 0; // blue
      quads[vi + 15] = 0; // alpha

      // -----------------------------
      quads[vi + 16] = 1; // vertex  x
      quads[vi + 17] = 1; // vertex  y

      quads[vi + 18] = getTexture().getMaxS() - getTexelHalfX();
      quads[vi + 19] = 0 - getTexelHalfY();

      quads[vi + 20] = 0; // red
      quads[vi + 21] = 0; // green
      quads[vi + 22] = 0; // blue
      quads[vi + 23] = 0; // alpha

      // -----------------------------
      quads[vi + 24] = 1; // vertex  x
      quads[vi + 25] = 0; // vertex  y

      quads[vi + 26] = getTexture().getMaxS() - getTexelHalfX();
      quads[vi + 27] = getTexture().getMaxT() + getTexelHalfY();

      quads[vi + 28] = 0; // red
      quads[vi + 29] = 0; // green
      quads[vi + 30] = 0; // blue
      quads[vi + 31] = 0; // alpha
    }

    quadsBuffer = GLHelper.createFloatBuffer(quads);

    // Generate the vertices VBO
    gl.glGenBuffers(1, verticesID, 0);
    gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, verticesID[0]);
    gl.glBufferData(GL11.GL_ARRAY_BUFFER, 128 * maxParticles, quadsBuffer, GL11.GL_DYNAMIC_DRAW);
    gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);

    // By default the particle emitter is active when created
    active = true;

    // Set the particle count to zero
    particleCount = 0;

    // Reset the elapsed time
    elapsedTime = 0;

    indicesBuffer = GLHelper.createShortBuffer(indices);
  }