Code example for ByteBuffer

Methods: order, position, put

0
            4,  5,  8,  5,  8,  9,  5,  6,  9,  6,  9, 10,  6,  7, 10,  7, 10, 11, 
            8,  9, 12,  9, 12, 13,  9, 10, 13, 10, 13, 14, 10, 11, 14, 11, 14, 15 
        }; 
 
        mIndexBuffer = ByteBuffer.allocateDirect(indices.length);
        mIndexBuffer.order(ByteOrder.nativeOrder());
        mIndexBuffer.put(indices);
        mIndexBuffer.position(0);
    } 
 
    /** 
     * Draw the indexed arrays using the currently bound texture 
     * 
     * @param gl openGL context reference 
     */ 
    @Override 
    public void draw(GL10 gl) {
        mColor.setAsGLColor(gl);
 
        gl.glVertexPointer(2, GL10.GL_FLOAT, 0, mVerts);
        gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, mTexCoords);