i've tried using
floatbuffer.put(float[]);
but as i am handling more than 200 squares, all with diferent texture coordinates that are updated each frame, my fps drop drastically, and the game becomes too far to be fluid.
y thought the method mentioned on badlogicgames.com, about of, instead use floatbuffer, use a intbuffer but, is the same thing, equal of slow at the moment of the method "put" of the buffer.
so, how i could update all my floatbuffers with a best performance?
EDIT: i've solved my problem, the "put" method itself is not slow, the problem is when a new float is initialized for each floatbuffer, instead of that, i just change the value of each element contained in the floatarray and that avoids many GC activity.. well i think.
There are a number of ways to improve performance. Briefly, here are a few:
1) Initialize the floatbuffer and an apply a transformation each each frame: - If your squares are moving across the screen, place them once in a floatbuffer, and then apply a separate matrix transformation to each one. In this method, you fill the floatbuffer once, and just update the transformations each turn.
2) Put only unique shapes in the floatbuffer - If any of your squares are duplicates of each other, call the same buffer each frame to conserve memory.
3) Use Vertex Buffer Objects and Index Buffer Objects - It sounds like you might have done this, but store the data in a vertex buffer, and call the vertices using the indices of the array.
If you are still having issues, I recommend taking a look at this tutorial: http://www.learnopengles.com/android-lesson-one-getting-started/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With