*sigh*
So one of the major irritations in game-development for the Android just reared-up and bit me in the ass - that of the Dreaded, Double-damned FloatBuffer.What is a floatbuffer? Its a buffer of floats! Basically, its an array that you can put floats into singly, or in large chunks. What is it used for? OpenGL ES - you use floatbuffers to store mesh vertices and the like. What is the problem with it? Lets find out!You would think that creating a floatbuffer, and adding in some float vertex data for batched drawing in OpenGL wouldn't be that annoying, especially when doing that with an IntBuffer or a ShortBuffer or a ByteBuffer takes practically zero time. In theory, adding something into a primitive buffer ought to take about as much time as assigning a value to an array. Maybe a bit slower, but not enough to be a problem.Individual draw calls in OpenGL are sorta expensive, so batching draw calls is a good idea. Lets assume a particle system with 200 particles. Now, 200 draw calls in OpenGL ES would slow things down a bit (at least enough to be noticable), so batching is perfect here since you can store all the particle images on the same texture. 200 particles requires 4000 floats - 12 for vertex data, 8 for uv data, times 200. A sizeable array, certainly but not mindboggling.Since the particles move, we have to clear the floatbuffer and rebuild it every frame, adding in the vertex data for every particle, and then drawing it all in one fell swoop. Since in theory, you would construct the floatbuffer from the array with one nice memory-copy operation, you'd think you would see a nice increase in performance.Right?![Image](http://kyon.pl/static/thumb/16562.jpg)
that was quite the anticlimax.
I concur.
I never knew there was such a problem with the android. How informative! :D
I just lol'd when I saw your mp.
That's really annoying :/ Why didn't they just port the Java version, since android uses a fair amount of the native java libraries right??
@tyler - they *did* port the java version. They just fucked it up.