After running -Xprof on my game and finding that 79% of my time is spent in org.lwjgl.opengl.Win32Display.swapbuffers, I decided to optimize my opengl code a bit. Optimization of choice: vertex arrays.
What I’m wondering is how to use vertex arrays with lots of sprites (and particles eventually).
Can I put all the vertices from my sprites into a single FloatBuffer and then just use glDrawArrays for each sprite, giving an offset however many vertices have already been used? Or should each sprite keep its own FloatBuffer of points (and tex coords etc.) and then I use glVertexPointer for each sprite?
I’m primarily concerned with just making it work at this point, but I’d certainly be interested in hearing about which way would be better for whatever reasons.
Also, am I going to see much of a performance difference by using vertex arrays? I created a test app that renders 810,000 points and I get exactly 14 fps with and without vertex arrays… is that expected or am I doing something wrong?