Code example for GL10

Methods: glClear, glEnable, glLoadIdentity, glRotatef, glTranslatef

0
    } 
 
    @Override 
    public void onDrawFrame(GL10 gl) {
        // Clear color and depth buffers 
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
 
        // ----- Render the Cube ----- 
        gl.glLoadIdentity();                  // Reset the model-view matrix
 
        //    Check if the light flag has been set to enable/disable lighting 
        gl.glEnable(GL10.GL_LIGHTING);
 
        // Translate into the screen 
       // background.draw(gl, 0); 
 
        gl.glTranslatef(0.0f, 0.0f, -5.0f);
 
        gl.glRotatef(xRot, 0.0f, 1.0f, 0.0f);
        gl.glRotatef(yRot, 1.0f, 0.0f, 0.0f);
        sphere.draw(gl);
    } 
}