Thanks.  Here's the complete function if anyone else needs it.

You just replace FloatBuffer.wrap with DirectWrap.wrap


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

public class DirectWrap {


        public static FloatBuffer wrap(float[] f_array){
                FloatBuffer fb =
                        ByteBuffer.allocateDirect( 4 * f_array.length ).order(
                                        ByteOrder.nativeOrder() 
).asFloatBuffer();

                fb.put(f_array);
                fb.position(0);


                return fb;


        }




}

On Sep 22, 9:23 am, danaimset <[email protected]> wrote:
> Hi
>
> For example:
>
> FloatBuffer verticesBuffer;
>
> public void setVertices(float[] vertices) {
>         ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length * 4); //
> float is 4 bytes
>         vbb.order(ByteOrder.nativeOrder());
>         verticesBuffer = vbb.asFloatBuffer();
>         verticesBuffer.put(vertices);
>         verticesBuffer.position(0);
>
>
>
>
>
>
>
> }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to