In this recipe, we will learn how to create a point cloud based on an image selected by the user. We will create a grid of points where each point will correspond to a pixel. The x and y coordinates of each point will be equal to the pixel's position on the image, and the z coordinate will be calculated based on its color.
Include the necessary files to work with OpenGL, image surfaces, VBO meshes, and loading images.
Add the following code to the top of the source file:
#include "cinder/gl/gl.h" #include "cinder/Surface.h" #include "cinder/gl/Vbo.h" #include "cinder/MayaCamUI.h" #include "cinder/ImageIo.h"
Also, add the following using
statements:
using namespace ci; using namespace ci::app; using namespace std;