Code example for ShortBuffer

Methods: positionput

0
         
        ByteBuffer ibb =
            ByteBuffer.allocateDirect(indices.length * SHORT_BYTES);
        ibb.order(ByteOrder.nativeOrder());
        ShortBuffer shortIndexBuffer = ibb.asShortBuffer();
        shortIndexBuffer.put(indices);
        shortIndexBuffer.position(0);
        this.mIndexBuffer = shortIndexBuffer;
    } 
     
    /** 
     * Copies the given data into the instance 
     * variables mVertexBuffer, mTexcoordBuffer, mNormalBuffer, mColorBuffer, 
     * and mIndexBuffer. 
     *  
     * @param vertices an array of fixed-point vertex coordinates 
     * @param texcoords an array of fixed-point texture coordinates 
     * @param normals an array of fixed-point normal vector coordinates 
     * @param colors an array of fixed-point color channel values 
     * @param indices an array of int indices 
     */