Code example for ShortBuffer

Methods: clear, flip, put

0
	// A: indices - array of indices (shorts) to set 
	//    offset - offset to first index in array 
	//    length - number of indices in array (from offset) 
	// R: [none] 
	public void setIndices(short[] indices, int offset, int length)  {
		this.indices.clear();                           // Clear Existing Indices
		this.indices.put( indices, offset, length );    // Set New Indices
		this.indices.flip();                            // Flip Index Buffer
		this.numIndices = length;                       // Save Number of Indices
	} 
 
	//--Bind--// 
	// D: perform all required binding/state changes before rendering batches. 
	//    USAGE: call once before calling draw() multiple times for this buffer. 
	// A: [none] 
	// R: [none] 
	public void bind()  { 
		// bind vertex position pointer 
		vertices.position( 0 );                         // Set Vertex Buffer to Position
		GLES20.glVertexAttribPointer(mPositionHandle, positionCnt, 
				GLES20.GL_FLOAT, false, vertexSize, vertices);