Physics Simulation
Particle System


The particle demo consists of a complex OpenCL program containing a number of different kernels to sort, collide and integrate the 16384 bodies in the simulation. The positions and velocities are stored in OpenGL vertex buffers which are then rendered as a point sprites. The buffers are shared with the OpenCL kernels that compute the rigid body dynamics, avoiding an expensive buffer copy between OpenGL and OpenCL. Despite the number of kernels involved, the simulation runs at the maximum 40 fps limit imposed by OpenCL Studio. 




In this example, a point set is used to render the N-Body simulation. The vertex buffer containing the points has not been shared with OpenCL. Even though the body positions have to be copied from the OpenCL buffer to the OpenGL vertex buffer each frame, this particular example consisting of 16,384 bodies still runs at approximately 26 fps on a GeForce 8800GT. This demo also includes an interface to experiment with different initial conditions, time scales and damping forces.