Android examples for java.nio:FloatBuffer
create Float Buffer from float array
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; public class Main { public static FloatBuffer createFloatBuffer(float[] triangleCoords) { FloatBuffer vertexbuffer; ByteBuffer bb = ByteBuffer .allocateDirect(triangleCoords.length * 4);// 9*4 bb.order(ByteOrder.nativeOrder()); vertexbuffer = bb.asFloatBuffer(); vertexbuffer.put(triangleCoords); vertexbuffer.position(0);//from w w w. ja v a 2 s . c o m return vertexbuffer; } }