private float[] generatePositions() {
        final int size = ParticleSystem.PARTICLE_COUNT * ParticleSystem.POS_DATA_SIZE * 6;

        final float height = 5.0f;
        final float width = height * mRenderer.ratio;

        final float[] posData = new float[size];

        final float z = 0f;

        int offset = 0;
        for (int p = 0; p < ParticleSystem.PARTICLE_COUNT; p++) {
            final float uc = MathHelper.mix(-width, width, Math.random());
            final float vc = MathHelper.mix(-height, height, Math.random());

            final float u0 = uc;// + delta;
            final float v0 = vc;// + delta;
            final float u1 = uc;// - delta;
            final float v1 = vc;// - delta;

            final int elementsPerPoint = ParticleSystem.POS_DATA_SIZE;

            //  1---2
            //  | / |
            //  3---4

            final float[] p1 = {u1, v0, z};
            final float[] p2 = {u0, v0, z};
            final float[] p3 = {u1, v1, z};
            final float[] p4 = {u0, v1, z};

            for (int i = 0; i < elementsPerPoint; i++)
                posData[offset++] = p1[i];
            for (int i = 0; i < elementsPerPoint; i++)
                posData[offset++] = p3[i];
            for (int i = 0; i < elementsPerPoint; i++)
                posData[offset++] = p2[i];

            for (int i = 0; i < elementsPerPoint; i++)
                posData[offset++] = p3[i];
            for (int i = 0; i < elementsPerPoint; i++)
                posData[offset++] = p4[i];
            for (int i = 0; i < elementsPerPoint; i++)
                posData[offset++] = p2[i];
        }

        return posData;
    }
Started by Artem Kholodnyi on 11/29/15 6:13 PM -- com.yalantis.starwarsdemo.particlesys
demo/src/main/java/com/yalantis/starwarsdemo/particlesys/ParticlesGenerator.java