I'm trying to implement a state preserving particle system on the iPhone using OpenGL ES 2.0. By state-preserving, I mean that each particle is integrated forward in time, having a unique velocity and position vector that changes with time and can not be calculated from the initial conditions at every rendering call.
Here's one possible way I can think of.
- Setup particle initial conditions in VBO.
- Integrate particles in vertex shader, write result to texture in fragment shader. (1st rendering call)
- Copy data from texture to VBO.
- Render particles from data in VBO. (2nd rendering call)
- Repeat 2.-4.
The only thing I don't know how to do efficiently is step 3. Do I have to go through the CPU? I wonder if is possible to do this entirely on the GPU with OpenGL ES 2.0. Any hints are greatly appreciated!