2Ddemo

This is a simple opencl demo which shows how we can use the opencl library along with opengl to create compelling interactive applications. To keep things simple I use 2D which simplifies the collision detection algorithm that has to be written in the OpenCL kernel.

The demo starts with a box at the center and a lot of balls bouncing around. The user can use the mouse to place new boxes in the scene. Once added, the balls start bouncing off the newly added box as well.

Technique:

Each ball's collision checks with the list of boxes is done in each invocation of the kernel.

This could easily be extended to the 3D as well.

Attached is the demo source code in visual studio express edition. You will need glut and opencl to be installed on your system.