2D Flocking Simulator - GPU Programming Prototype

GPU-programming - not just Compute Shaders

This is a simple OpenGL application to simulate a flocking species using GPU programming with Nvidia's CUDA using the interopability between CUDA and OpenGL.
I successfully simulate 512² (262144) 2d agents (called boids) using three GPU passes: first, a sorting pass to sort the boid data for optimization. second is the simulation pass, where the flocking behaviour is being calculated and executed on the boid data. The third pass calculates the vertices to display the boids using the current boid data and passes them to the OpenGL rendering pipeline.
The flocking behaviour is very classic in its features:

  • Wander Behaviour
  • Alignment
  • Cohesion
  • Seperation
For more information on how this implemented, check out the github repository.


  • Vivien Baguio


  • C++
  • Nvidias CUDA
  • OpenGL with Freeglut
  • Dear ImGUI

Early state of the animation

More Screenshots