OpenGL ES multiple objects not being rendered

Posted by ladiesMan217 on Game Development See other posts from Game Development or by ladiesMan217
Published on 2012-04-06T05:19:18Z Indexed on 2012/04/06 5:42 UTC
Read the original article Hit count: 199

Filed under:
|
|

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);

}

© Game Development or respective owner

Related posts about android

Related posts about opengl-es