Getting ready

We'll start the particle system as described in the Creating a particle system using transform feedback recipe. We'll just make a few modifications to that basic system. 

Instead of three pairs of buffers, we'll use four this time. We'll need buffers for the particle's position, velocity, age, and rotation. The rotation buffer will store both the rotational velocity and the angle of rotation using the vec2 type. The x component will be the rotational velocity and the y component will be the angle. All shapes will rotate around the same axis. If desired, you could extend this to support a per-particle axis of rotation.

Set up the other buffers in the same way as in the previous recipe.

Because we are drawing full meshes, we ...

Get OpenGL 4 Shading Language Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.