I am doing the following to render multiple balls move around the screen but only 1 ball is seen to appear and function. I don't know why the rest (count-1) balls are not being drawn
public void onDrawFrame(GL10 gl) {
// TODO Auto-generated method stub
gl.glDisable(GL10.GL_DITHER);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glClientActiveTexture(DRAWING_CACHE_QUALITY_HIGH);
gl.glLoadIdentity();
for(int i=0;i<mParticleSystem.getParticleCount();i++){
gl.glPushMatrix();
gl.glTranslatef(mParticleSystem.getPosX(i), mParticleSystem.getPosY(i), -3.0f);
gl.glScalef(0.3f, 0.3f, 0.3f);
gl.glColor4f(r.nextFloat(), r.nextFloat(), r.nextFloat(), 1);
gl.glEnable(GL10.GL_TEXTURE_2D);
mParticleSystem.getBall(i).draw(gl);
gl.glPopMatrix();
}
}
Here is my void draw(GL10 gl) method
public void draw(GL10 gl){
gl.glEnable(GL10.GL_CULL_FACE);
gl.glEnable(GL10.GL_SMOOTH);
gl.glEnable(GL10.GL_DEPTH_TEST);
// gl.glTranslatef(0.2f, 0.2f, -3.0f);
// gl.glScalef(size, size, 1.0f);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertBuff);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, points/2);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}
I couldnt take the snapshot on my Samsung Phone but here is the emulator screenshot. In reality, the ball moves around with change in orientation and acceleration and keeps changing color randomly (due to r.nextFLoat()) . However, the other 35 balls arent even being rendered as you can see. How can I fix this?


mParticleSystemclass contains an array of balls. I Iterate over each ball and set their position. Yea, so only first ball is rendered. – ladiesMan217 Apr 6 '12 at 9:39