Code example for FloatBuffer

Methods: capacity, glBufferData

0
 
	public void load(String name, FloatBuffer buf) {
		delete(name);
		GLES20.glGenBuffers(1, temp, 0);
		GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, temp[0]);
		GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, buf.capacity() * 4, buf,
				GLES20.GL_STATIC_DRAW);
		GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
		buffers.put(name, new BufferInfo(temp[0]));
	} 
 
	public void load(String name, FloatBuffer buf, Map<String, Integer> offsets) {
		load(name,buf);
		BufferInfo bi = buffers.get(name);
		bi.namedOffsets.putAll(offsets);
	} 
 
	public void bind(String name, int target) {
		BufferInfo bi = buffers.get(name);
		if (bi != null) {
			GLES20.glBindBuffer(target, bi.id);