This can be quite easily done without needing any dynamic data, but it does depend on what kind of particle behaviour you want.
In the simplest case you can do a one-time-only initialization of your 1 million particles to a buffer object. Give them an initial position, velocity and acceleration, then the new position at any given point in time is just a simple calculation (e.g see http://www.ugrad.math.ubc.ca/coursedoc/math101/notes/applications/velocity.html).
I have been playing around with the above concept. Just having initial static values for velocity and acceleration, then determining the positions of my particles using elapsed time. But I can't help feel like I am limited to only making simple explosions or stream fountains. I was thinking the limitation of this just extended to particles effecting world objects or each other.
For example, I attempted to make some particles orbit around a point
//In my vertex shader //deltaTime is elapsed time //accleration is a random static float value; Generated at init time //initVelocity is a random static float value; Generated at init time //orbitRadius is the size of the particles orbit around the point //orbitPoint the point to orbit //PI the value of pi //Calc the orbit speed over time vec2 orbitSpeed; orbitSpeed.x = initVelocity.x + (accleration.x * deltaTime); orbitSpeed.y = initVelocity.y + (accleration.y * deltaTime); //Calculate the position of the particle over time position.x = orbitPoint.x + cos(orbitSpeed.x * PI) * orbitRadius.x; position.y = orbitPoint.y + sin(orbitSpeed.y * PI) * orbitRadius.y;But all the particles "jam up" making the effect look much like the hands of an analog clock.
Also particles move much faster when using the same acceleration values, opposed to the way of stimulating the effect below and changing
the initVelocity value seems to have no effect either
If I use my sprite batcher to simulate particles and update on the CPU side, everything seems to be fine
//the delta value is not elapsed time, but time per frame. "Normal" delta time accelerationX = 20.0f; accelerationY = 20.0f; orbitSpeedX += accelerationX * delta; orbitSpeedY += accelerationY * delta; positionX = orbitPointX + cos(orbitSpeedX * PI) * orbitRadiusX; positionY = orbitPointY + sin(orbitSpeedY * PI) * orbitRadiusY;So I'm not sure if it chalks up to horrible math or the limitation of only having static values. I mean I should be able to do this and have it look right when basing things on time in my vertex shader right?