Code example for GL10

Methods: glClear, glDisable, glEnable, glFinish, glLoadIdentity, glRotatef, glScalef, glTranslatef

0
    /** 
     * Here we do our drawing 
     */ 
    public void onDrawFrame(GL10 gl) {
        //Clear Screen And Depth Buffer 
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);    
        gl.glLoadIdentity();                    //Reset The Current Modelview Matrix
         
        //Check if the light flag has been set to enable/disable lighting 
        if(light) {
            gl.glEnable(GL10.GL_LIGHTING);
        } else { 
            gl.glDisable(GL10.GL_LIGHTING);
        } 
         
        //Check if the blend flag has been set to enable/disable blending 
        if(blend) {
            gl.glEnable(GL10.GL_BLEND);            //Turn Blending On ( NEW )
            gl.glDisable(GL10.GL_DEPTH_TEST);    //Turn Depth Testing Off ( NEW )
             
        } else { 
            gl.glDisable(GL10.GL_BLEND);        //Turn Blending On ( NEW )
            gl.glEnable(GL10.GL_DEPTH_TEST);    //Turn Depth Testing Off ( NEW )
        } 
         
        //Drawing 
        gl.glTranslatef(0.0f, 0.0f, z);            //Move z units into the screen
        gl.glScalef(0.8f, 0.8f, 0.8f);             //Scale the Cube to 80 percent, otherwise it would be too large for the screen
         
        //Rotate around the axis based on the rotation matrix (rotation, x, y, z) 
        gl.glRotatef(xrot, 1.0f, 0.0f, 0.0f);    //X
        gl.glRotatef(yrot, 0.0f, 1.0f, 0.0f);    //Y
                 
        cube.draw(gl, filter);                    //Draw the Cube    
        gl.glFinish();
        mTester.decreaseCounter();
        //Change rotation factors 
        xrot += xspeed;
        yrot += yspeed;
    }