-
Install dependencies:
vcpkg install opencl vcpkg install opengl
-
Modify header file if needed. Change:
#include <CL/cl.hpp>
into:
#include <CL/cl2.hpp>
-
By default, the particle color is determined by density. To produce the result in the sample, please change the << particles.cl>> shader file. Change:
colorVec[i * 4 + 0] = diff < 1 ? 1 : 2 - diff; colorVec[i * 4 + 1] = diff < 1 ? diff : 1; colorVec[i * 4 + 2] = 0; colorVec[i * 4 + 3] = 1;
into:
colorVec[i * 4 + 0] = i < 4000; colorVec[i * 4 + 1] = 4000 <= i && i < 6000; colorVec[i * 4 + 2] = 6000 <= i; colorVec[i * 4 + 3] = 1;
-
Run the program in the <<PROJECT_ROOT_DIRECTORY>> (the one contains shader/ folder).
-
It shall produce the following result:
- IMPORTANT!!! Press "P" to exit!.
- The result is rendered in a 3D world. Press WASD to move around. Press R to rise up, F to fall down. Move mouse to look around.