-
Book Overview & Buying
-
Table Of Contents
OpenFrameworks Essentials
By :
We would like to introduce one of the funniest openFrameworks examples, which we like a lot. The example captures the images from a webcam and draws it on the screen as a fancy 3D surface, as shown in the following picture:

3D surface generated by an openFrameworks example
This is the meshFromCamera example located in the examples/3d folder.
This example requires a webcam. If your computer does not have a built-in webcam, and you have no external webcam to connect to, please work with another example, for instance, examples/3d/3DPrimitivesExample.
We cannot run the example immediately after installing openFrameworks. The reason is that openFrameworks examples are distributed as source files only, without executable files that you can run.
To obtain the executable file, we need to build the project, that is, compile its C++ source code to machine code and link it into an executable file. Let's do it and then run the example by performing the following steps:
examples/3d/meshFromCamera.meshFromCamera.xcodeproj (Xcode project), meshFromCamera.sln (Visual Studio project), or meshFromCamera.workspace (Code::Blocks project).meshFromCamera project will open in your IDE.For Xcode users
In the project, there exist several schemes that indicate the part of the project to build and a number of settings for it. Often at first run, the scheme is set to openFrameworks, as shown on the following screenshot:

Scheme selector in Xcode
If so, the compiler builds openFrameworks, but not the project. To resolve the issue, please click on the scheme name. A context menu will appear. Select the meshFromCamera Release scheme there. After this, perform building as described in step 4.
This example involves several topics, such as capturing frames from the camera, creating 3D surfaces, and texturing them. You will discover these topics in Chapter 4, Working with Raster Graphics – Images, Videos, and Shaders, and Chapter 5, Creating 3D Graphics, and will be able to build similar and even more sophisticated projects easily.
Change the font size
Change margin width
Change background colour