Code example for Buffer

Methods: capacity

0
    /** 
     * Returns the number of triangles associated with this shape. 
     */ 
    public int getNumTriangles() { 
        if (mPrimitive == GL10.GL_TRIANGLES) {
            return mIndexBuffer.capacity() / 3;
        } else if (mPrimitive == GL10.GL_TRIANGLE_STRIP) {
            return mIndexBuffer.capacity() - 2;
        } 
        return 0; 
    } 
     
    /** 
     * 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