Hello there Non-direct buffers exist within the java heap space, and thus may be shuffled around by the garbage collector to reduce fragmentation. OpenGL may try and use data from the buffers that you pass in at any time - if the buffer has been moved since you passed its address to OpenGL then you'll be reading data from an invalid location. Direct buffers are allocated outside of the java heap, and thus do not move around. For opengl use, always allocate buffers like so
FloatBuffer fb = ByteBuffer.allocateDirect( size ).order( ByteBuffer.nativeOrder() ).asFloatBuffer(); Also be aware of the performance issue in http://code.google.com/p/android/issues/detail?id=11078 Ryan On Jan 6, 5:13 am, kong <[email protected]> wrote: > I use private FloatBuffer triggerBuffer = FloatBuffer.wrap(new float[] > { > 0,0,20, > 1,0,-20 , > 0.5f,1,-20}); > have the error. > > java.lang.IllegalArgumentException: Must use a native order direct > Buffer > > Why? -- 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

