package de.advancedplatformer.util;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;

import org.lwjgl.BufferUtils;

public abstract class BufferUtil {

	public static ByteBuffer createByteBuffer(byte[] array){
		ByteBuffer out = BufferUtils.createByteBuffer(array.length).order(ByteOrder.nativeOrder());
		out.put(array);
		out.flip();
		return out;
	}
	
	public static FloatBuffer createFloatBuffer(float[] array){
		FloatBuffer out = BufferUtils.createFloatBuffer(array.length);
		out.put(array);
		out.flip();
		return out;
	}
	
	public static IntBuffer createIntBuffer(int[] array){
		IntBuffer out = BufferUtils.createIntBuffer(array.length);
		out.put(array);
		out.flip();
		return out;
	}
}
