• Home
  • About
    • Muru Chen photo

      Muru Chen

      Game programmer, Game designer, photographer & Interactive media artist

    • Learn More
    • Email
    • LinkedIn
    • Github
  • Games
  • OpenGL
  • Interactive Arts

2D Particle System

Reading time ~1 minute

Demo

Main Principles and processes

Orthographic camera

Make a orthographic camera that can be zoomed by mouse;

Click mouse to create particles

Get the position of mouse. Transform the rectangle and pass the matrix position to vertex shader.

Object-oriented programming

Create a particle class that includes particle.emit(), particle.render(), particle.update() and some particle properties.

Create a particle pool that contains 1000 particles. Every time when the user create particle, the particle set active from the pool. When the particle’s lifetime is less 0, the particle is set to inactive.

Download codes


OpenGLC++ Share Tweet +1