* Usually, the first thing one might want to do is to clear 
         * the screen. The most efficient way of doing this is to use 
         * glClear(). 
         * Now we're ready to draw some 3D objects 
        gl.glTranslatef(0, 0, -2);
         * All the magic happens here. The rotation matrix mR reported by 
         * SensorManager.getRotationMatrix() is a 4x4 row-major matrix. 
         * We need to use its inverse for rendering. The inverse is 
         * simply calculated by taking the matrix' transpose. However, since 
         * glMultMatrixf() expects a column-major matrix, we can use mR 
         * directly! 
        gl.glMultMatrixf(mR, 0);
        // some test code which will be used/cleaned up before we ship this. 
        //gl.glMultMatrixf(mI, 0); 
        gl.glVertexPointer(3, GL_FLOAT, 0, mVertexBuffer);
        gl.glColorPointer(4, GL_FLOAT, 0, mColorBuffer);
        gl.glDrawElements(GL_LINES, 6, GL_UNSIGNED_BYTE, mIndexBuffer);
    public void onSurfaceChanged(GL10 gl, int width, int height) {
        gl.glViewport(0, 0, width, height);