Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying OpenFrameworks Essentials
  • Table Of Contents Toc
OpenFrameworks Essentials

OpenFrameworks Essentials

By : Denis Perevalov
5 (7)
close
close
OpenFrameworks Essentials

OpenFrameworks Essentials

5 (7)
By: Denis Perevalov

Overview of this book

If you are a programmer, visual artist, or designer with experience in creative coding, and want to use openFrameworks to create fun, stunning, and interactive applications, this is the book for you. Basic knowledge of programming languages, such as C++, Java, Python, or JavaScript, will be enough to proceed with the book.
Table of Contents (13 chapters)
close
close
12
Index

Running your first example

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:

Running your first example

3D surface generated by an openFrameworks example

This is the meshFromCamera example located in the examples/3d folder.

Tip

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:

  1. Open the example folder examples/3d/meshFromCamera.
  2. Find there the file named meshFromCamera.xcodeproj (Xcode project), meshFromCamera.sln (Visual Studio project), or meshFromCamera.workspace (Code::Blocks project).
  3. Double-click on this file, and the meshFromCamera project will open in your IDE.
  4. Build the project by pressing Command + B in Xcode, F7 in Visual Studio, or by clicking on the Build button in Code::Blocks.

    Tip

    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:

    Running your first example

    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.

  5. Run the project by clicking on the corresponding button in your IDE (normally, it's depicted as a small triangle, meaning the play symbol). After running, you will see your webcam's image drawn as a distorted 3D surface.
  6. Press Esc to stop the execution.

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.

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
OpenFrameworks Essentials
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon