I just want to learn basics of VBO and create simple particles system. I would like to get simple example how i can draw multiple particles in single VBO. I mean i know how i can draw multiple particles in single VBO, but i have no idea how i can change each particle position?
You could put all particles into a list, then create a vbo and add each particles vertices into that single vbo.
I would like to get example in code
Uhm you're just lazy. Everyone is when they are saying something like that. Everyone says that from time to time.
I'm lazy to learn something, so I will try to explain how to do it to you.
* Create a VBO (You know how to do it I believe).
* Don't add particle's data to any VBO when creating particles.
* Make an array or a list of particles.
* Just make the particles static (not moving at all) for the first time you're trying this.
* Go through your array or list. Add each particles vertices to the FloatBuffer like you did with each single particle.
* After you added all particles vertices to the FloatBuffer, send the FloatBuffer to VBO.
You're kinda done.
To edit data in the VBO, you need to use glMapBuffer(); It will return a ByteBuffer. You can do ByteBuffer.asFloatBuffer to get FloatBuffer from it. That will return the FloatBuffer that you sent to the VBO.
You can edit that FloatBuffer as you like.