Code example for IntBuffer

Methods: position, put

0
        // must have their byte order set to native order 
 
        ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length*4); 
        vbb.order(ByteOrder.nativeOrder()); 
        mVertexBuffer = vbb.asIntBuffer(); 
        mVertexBuffer.put(vertices); 
        mVertexBuffer.position(0); 
 
        ByteBuffer cbb = ByteBuffer.allocateDirect(colors.length*4); 
        cbb.order(ByteOrder.nativeOrder()); 
        mColorBuffer = cbb.asIntBuffer(); 
        mColorBuffer.put(colors); 
        mColorBuffer.position(0); 
 
        mIndexBuffer = ByteBuffer.allocateDirect(indices.length); 
        mIndexBuffer.put(indices); 
        mIndexBuffer.position(0); 
    } 
 
    public void draw(GL10 gl) 
    {