Skip to content

semohr/Flocking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flocking algorithm in OpenGL

Small OpenGL example using the Flocking algorithm in 3D. A central force proportional to the distance from the coordinate origin is applied to keep the boids in frame. This also creates a fun chaotic behaviour.

One could also move the visible frame according to the center of mass, but that is a project for another day ;)

The frame can be controlled with the cursor (see callback.cpp).

Example

Example

Dependencies:

glad could work without installing since I've added my own glad files in the src folder

How to run:

  1. compile
make all
  1. run
./main.exec

Only tested on linux, if one wants to run it on windows, it is probably necessary to link against

-lopengl32 -ldl -lglfw3 -lstdc++

and include the glfw3.dll in the source folder.