Code example for GL10

Methods: glClear, glColor4f, glDrawArrays, glLoadIdentity, glMatrixMode, glRotatef, glVertexPointer, gluLookAt

0
	// called for each redraw of the GLSurfaceView 
	@Override 
    public void onDrawFrame(GL10 gl) {
		 
        // Redraw background color 
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
         
        // Set GL_MODELVIEW transformation mode 
        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glLoadIdentity();   // reset the matrix to its default state
         
        // When using GL_MODELVIEW, you must set the view point 
        GLU.gluLookAt(gl, 0, 0, -5, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
         
        // Use the mAngle member as the rotation value 
        gl.glRotatef(mAngle, 0.0f, 0.0f, 1.0f);
        /* 
        // Create a rotation for the triangle 
        long time = SystemClock.uptimeMillis() % 4000L; 
        float angle = 0.090f * ((int) time); 
        gl.glRotatef(angle, 0.0f, 0.0f, 1.0f); 
        */ 
         
        // Draw the triangle 
        gl.glColor4f(0.63671875f, 0.76953125f, 0.22265625f, 0.0f);
        gl.glVertexPointer(3, GL10.GL_FLOAT, 0, triangleVB);
        gl.glDrawArrays(GL10.GL_TRIANGLES, 0, 3);
    } 
     
	// called if the geometry of the GLSurfaceView changes, for example when the device's screen orientation changes 
	@Override 
    public void onSurfaceChanged(GL10 gl, int width, int height) {