examples/gl/computeShaderParticlesExample/README.md
This example demonstrates how to use a compute shader to set up an animated point cloud with editable parameters. Compute shaders are rather used to do generic computation in contrast to graphics-oriented shaders. In this case the shader computes the movement of particles using a flocking algorithm based on three parameters: attraction, cohesion and repulsion. It additionally includes different forces in order to separate the particles into groups.
You will learn how to..
ofNoise()ofParameter objects and ofxGui to create editable variablesofEasyCamIn the code, pay attention to:
gl_GlobalInvocationIDofBufferObject) for faster computation that allows to draw from one buffer while the other one is being updateddispatchCompute() from the C++ shader object and layout() from within the shaderWhen launching this app, you should see a cloud of particles floating in the center of a white cube. In the top left corner there is a panel to manipulate the particle cloud. The panel also includes a display of the current framerate.
Instructions for use:
attr1_force to adjust the force applied to all particles with an odd indexattr2_force to adjust the force applied to all particles with an even indexThis Example uses the following classes: