Code example for ShortBuffer

Methods: flip, put

0
		gl.glGenBuffers(2, handleBuf);
		vboHandle = handleBuf.get(0);
		iboHandle = handleBuf.get(1);
 
		indices = BufferUtils.newShortBuffer(12);
		indices.put(new short[] {0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4});
		indices.flip();
 
		float c = Color.toFloatBits(1f, 1f, 1f, 1f);
		vertices1 = BufferUtils.newFloatBuffer(40);
		vertices1.put(new float[] {-1, -1, c, 0, 0, -1, -0.5f, c, 0, 1, -0.5f, -0.5f, c, 1, 1, -0.5f, -1f, c, 1, 0, 0, -1, c, 0, 0,
			0, -0.5f, c, 0, 1, 0.5f, -0.5f, c, 1, 1, 0.5f, -1f, c, 1, 0});
		vertices1.flip();
		vertices2 = BufferUtils.newFloatBuffer(20);
		vertices2.put(new float[] {-1, 0, c, 0, 0, -1, 0.5f, c, 0, 1, -0.5f, 0.5f, c, 1, 1, -0.5f, 0, c, 1, 0});
		vertices2.flip();
	} 
}