Particle system lifetimes in OpenGL ES 2

Posted by user16547 on Game Development See other posts from Game Development or by user16547
Published on 2013-10-19T13:42:02Z Indexed on 2013/10/19 16:10 UTC
Read the original article Hit count: 165

Filed under:
|

I don't know how to work with my particle's lifetimes. My design is simple: each particle has a position, a speed and a lifetime. At each frame, each particle should update its position like this:

position.y = position.y + INCREMENT * speed.y

However, I'm having difficulties in choosing my INCREMENT. If I set it to some sort of FRAME_COUNT, it looks fine until FRAME_COUNT has to be set back to 0. The effect will be that all particles start over at the same time, which I don't want to happen. I want my particles sort of live "independent" of each other.

That's the reason I need a lifetime, but I don't know how to make use of it. I added a lifetime for each particle in the particle buffer, but I also need an individual increment that's updated on each frame, so that when PARTICLE_INCREMENT = PARTICLE_LIFETIME, each increment goes back to 0.

How can I achieve something like that?

© Game Development or respective owner

Related posts about opengl-es2

Related posts about particles