In this recipe, we will calculate the intersection of the mouse cursor with a 3D model.
Include the necessary files to draw using OpenGL, use textures and load images, load 3D models, define OpenGL lights and materials, and use Cinder's Maya camera.
#include "cinder/gl/gl.h" #include "cinder/gl/Texture.h" #include "cinder/gl/Light.h" #include "cinder/gl/Material.h" #include "cinder/TriMesh.h" #include "cinder/ImageIo.h" #include "cinder/MayaCamUI.h"
Also, add the following using
statements:
using namespace ci; using namespace ci::app; using namespace std;
We will use a 3D model, so place a file and its texture in the assets
folder. For this example, we will be using a mesh file named ducky.msh
and a texture named ducky.png
.