Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
OpenFrameworks Essentials
OpenFrameworks Essentials

OpenFrameworks Essentials: Create stunning, interactive openFrameworks-based applications with this fast-paced guide

eBook
$9.99 $25.99
Paperback
$32.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

OpenFrameworks Essentials

Chapter 1. Getting Started with openFrameworks

In this chapter, we will introduce openFrameworks by covering the following topics:

  • What is openFrameworks?
  • Installing openFrameworks
  • Running an openFrameworks example

Finally, we will discuss the video synthesizer project, which we will develop throughout the book.

What is openFrameworks?

openFrameworks is a free, open source C++ framework that is intended to develop real-time projects, which use most modern computing devices' capabilities, such as video, audio, networking, and computer vision.

openFrameworks is developed by Zach Lieberman, Theodore Watson, and Arturo Castro, together with a big openFrameworks community. The current openFrameworks version is 0.8.4.

Its main features are:

  • openFrameworks is a framework for the easy development of real-time applications. All you need to do is implement a number of events, such as starting project and drawing, and openFrameworks will maintain all the stuff behind this, such as creating a graphical window and listening for mouse and keyboard events.
  • Its conception and philosophy is oriented for use in creative and experimental projects. openFrameworks contain many ready-to-use functions and classes to work with 2D and 3D graphics, video, audio, and so on.
  • It's a C++ framework, that is, you will code it using the C++ programming language. Your code will be compiled in native machine code and executed very efficiently. Many algorithms that work slowly when implemented in languages such as Python, Java, or Processing, could work significantly faster when implemented in openFrameworks.
  • openFrameworks is highly extensible. Its extensions are called addons. They are open source and are built by members of the openFrameworks community. Several hundreds of existing addons give you an opportunity to extend your project with the capabilities of various software libraries, popular sensors, and gadgets.
  • openFrameworks is cross-platform—the code you will write can be executed on many popular platforms, including OS X, Windows, Linux, iOS, Android, and Linux ARM devices such as Raspberry Pi.
  • Finally, it has a very friendly and active community. If you get stuck during developing with openFrameworks, you can get help from the openFrameworks forum.

Begin your acquaintance with openFrameworks by visiting and exploring its site openframeworks.cc. It contains a lot of useful information about openFrameworks, including download links, tutorials, documentation, forums, and news.

Installing openFrameworks

To develop projects with openFrameworks, you need to install an Integrated Development Environment (IDE) with the C++ compiler and openFrameworks.

To install them, perform the following steps:

  1. Go to openFrameworks' download page at openframeworks.cc/download.
  2. Find your platform on the page (OS X, Linux, Windows, iOS, Android, or Linux ARM) and select the desired IDE (Xcode, Code::Blocks, Eclipse, or Visual Studio). For developing with iOS, an OS X computer is required. Development on a Linux ARM device is done using the C++ compiler directly, without an IDE.

    Note

    All the IDEs mentioned are free. But, to run your project on an iOS device, you must buy an iOS Developer License from Apple for $99 per year.

  3. Download the openFrameworks archive by clicking on the corresponding link and unzip it.
  4. Click on the corresponding setup guide link and follow the instructions shown for installing and configuring the IDE and openFrameworks. Now you can develop and run your projects in openFrameworks.

    Tip

    Running openFrameworks projects on desktops (Mac OS X, Windows, or Linux) is simpler than on mobiles. So, if you are a novice in C++ or openFrameworks, we recommend that you start to develop your very first openFrameworks project for a desktop OS rather than a mobile one.

    After a while, when you are a little more comfortable with C++ and openFrameworks, you can easily port your project to mobiles, if needed. You will learn how to deploy openFrameworks projects on mobiles and Raspberry Pi in Chapter 8, Deploying the Project on iOS, Android, and Raspberry Pi.

The openFrameworks folder structure

It's time to look inside openFrameworks, so open the openFrameworks folder. It consists of a number of folders and files, as shown in the following screenshot (the screenshot is for OS X, but the folder structure is similar for all other platforms):

The openFrameworks folder structure

openFrameworks' folder structure

The most important folders for us now are apps and examples. The apps folder is the place where your own projects will be stored. The examples folder contains a collection of examples, demonstrating all the aspects of openFrameworks programming. The examples are categorized by topics, including 3D, graphics, sound, and video.

Now, let's run one of the examples.

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.

The video synthesizer application

A video synthesizer is an electronic device or a computer program that generates and transforms a video signal in a complex way. Video synthesizers are used for creating live visuals for DJ sets and performances, or serve as a visual part of interactive installations and mobile apps.

Tip

Probably the most famous analog video synthesizer was made by John Whitney in the middle of the twentieth century. Visual effects, obtained with the synthesizer, are demonstrated in his film Catalog (1961). It's worth watching on YouTube.

Throughout the book, we will build our own video synthesizer application. We will start with a simple project in the next chapter and will extend it by adding new features with each new chapter. At the end of the book, we will get a fully-fledged video synthesizer, which reveals many openFrameworks capabilities.

Typically, a video synthesizer consists of several modules—video generators, video players, video effects, and video mixers—connected to each other. Our synthesizer will include all these basic modules and will have the following structure:

  • A 2D image generator that produces pictures made from geometric shapes, (Chapter 2, Creating Your First openFrameworks Project)
  • A graphical user interface (GUI) consisting of sliders and checkboxes (Chapter 3, Adding a GUI and Handling Keyboard Events)
  • A player of image files, video files, and live videos from a camera (Chapter 4, Working with Raster Graphics – Images, Videos, and Shaders)
  • A video mixer that mixes several pictures using additive blending and the kaleidoscope video effect (Chapter 4, Working with Raster Graphics – Images, Videos, and Shaders)
  • A 3D surface generator that renders a textured and deformed sphere in 3D (Chapter 5, Creating 3D Graphics)
  • Various sources for controlling the synthesizer's parameters, such as LFO, sound analysis, text files (Chapter 6, Animating Parameters), networking, and an Arduino device (Chapter 7, Distributed and Physical Computing with Networking and Arduino)

This structure is shown in the following diagram:

The video synthesizer application

The video synthesizer's structure

Additionally, in Chapter 8, Deploying the Project on iOS, Android, and Raspberry Pi, we will see how to deploy the light version of the synthesizer on mobile devices: iOS, Android, and Raspberry Pi. In the last chapter, Chapter 9, Further Resources, we will consider ways to further enhance the synthesizer, get some advice on debugging and optimizing your future openFrameworks projects, and consider additional references on openFrameworks.

The synthesizer created will have quite a lot of GUI controls and control keys. If while working with the book you need a quick reference on some of them, please see Appendix A, Video Synthesizer Reference, where we have collected descriptions and references to all parts of the synthesizer.

For a short description of openFrameworks functions and classes discussed throughout the book, see Appendix B, openFrameworks Quick Reference.

Three reasons to create your own video synthesizer with openFrameworks

Why would you program a video synthesizer with openFrameworks? The reasons are the following:

  • You will get a handy, standalone application that provides you with interactive video wherever you need it (on a stage at your live performance or in your mobile), running on any platforms, and controlled by other programs or devices, such as mobiles or Arduino.
  • Our video synthesizer is exceptionally customizable. By changing just several lines of code, you will get a unique synthesizer. The more you change the code, the more you find that there are no limits to expressing your creative ideas.
  • By splitting the video synthesizer project into parts and then rearranging and adding new parts, you will obtain something different from the video synthesizer. For example, you can construct an interactive installation that transforms users' faces into abstract images. It could even be a mobile 3D drawing application that generates fantastic 3D landscapes. It's worth noting that you can easily incorporate LeapMotion, Kinect, and many other gadgets into your openFrameworks project in order to realize the interactive experience that you want.

Summary

In this chapter, you learned what openFrameworks is, how to install it, and also how to build and run its examples.

In the next chapter, we will create our own openFrameworks project that draws simple 2D graphics.

Left arrow icon Right arrow icon

Description

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.

What you will learn

  • Install openFrameworks and create a new project Generate 2D and 3D graphics Mix images and videos and process them with shaders Add GUI controls and adjust them from external devices and apps using the OSC protocol Control parameters with a timer, Perlin noise, and sound and text files Use the Arduino to control your application Build a video synthesizer project Run your project on iOS, Android, and Raspberry Pi devices

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Apr 23, 2015
Length: 206 pages
Edition : 1st
Language : English
ISBN-13 : 9781784396145
Category :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Apr 23, 2015
Length: 206 pages
Edition : 1st
Language : English
ISBN-13 : 9781784396145
Category :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 136.97
Mastering openFrameworks: Creative Coding Demystified
$48.99
OpenFrameworks Essentials
$32.99
Learning Three.js: The JavaScript 3D Library for WebGL - Second Edition
$54.99
Total $ 136.97 Stars icon
Banner background image

Table of Contents

12 Chapters
1. Getting Started with openFrameworks Chevron down icon Chevron up icon
2. Creating Your First openFrameworks Project Chevron down icon Chevron up icon
3. Adding a GUI and Handling Keyboard Events Chevron down icon Chevron up icon
4. Working with Raster Graphics – Images, Videos, and Shaders Chevron down icon Chevron up icon
5. Creating 3D Graphics Chevron down icon Chevron up icon
6. Animating Parameters Chevron down icon Chevron up icon
7. Distributed and Physical Computing with Networking and Arduino Chevron down icon Chevron up icon
8. Deploying the Project on iOS, Android, and Raspberry Pi Chevron down icon Chevron up icon
9. Further Resources Chevron down icon Chevron up icon
A. Video Synthesizer Reference Chevron down icon Chevron up icon
B. openFrameworks Quick Reference Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6
(8 Ratings)
5 star 87.5%
4 star 0%
3 star 0%
2 star 12.5%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Amazon Customer Aug 30, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I am not a programmer, though I have a bit of basic programming experience. This book is clear enough so that I can understand it and I can try out all the examples and use them as a basis for my own experiments.
Amazon Verified review Amazon
Yoichi Nagashima Jun 03, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
At first, I again strongly recommend to read the first book of the author "openFrameworks Essentials" for people who want to expand the possibility in designing interactive multimedia. I enjoyed that first book as my first experience about the openFrameworks. And I understood that openFrameworks can realize the same great projects like Max/MSP/jitter or Processing, but the final application is "standard", not as special environments : this is the open source culture, of course.This second book is presented by the author and a video artist. The author Denis Perevalov is a enthusiastic and sincere scientist, and he has collaborated with many artists in many projects. If you search his name in YouTube or in Vineo, you will enjoy many amazing interactive multimedia projects. Though I had thought that the title of this book "Essentials" means the advanced level from the first book, I understand this more thin book is rather practical version for students. The first book is a textbook, and this second book is the manual to develop an exciting "Video Synthesizer" for amazing VJ performance.In Processing website, Arduino website and Raspberry Pi website, there are standard "Tutorial" page for beginners. We are overwhelmed by the texts introducing many knowledges in an orderly manner, and fear that we cannot do anything before we do not master all of them. This is a problem of "text book" generally. On the contrary, this new book presents the "Video Synthesizer Structure" at the beginning. We can overview of the whole project constructed by each modules of openFrameworks, and we can study/test/arrange any part of them in response to our own request.The traditional education in design was "learn, then produce". But 21st-century design education is "producing with study", because we can get huge knowledges/know-hows by Internet and the system works realtime. This culture "Sketching" (Sketching in Hardware) expands by the open source culture in the world. We can be happy all by the open source culture and Internet - this book informs us the happy future in design, I think. I want to recommend with confidence this book to my students and research/design/education communities.
Amazon Verified review Amazon
Cameren Aug 30, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Step by step instructions to create a video synthesizer work really well. Great introduction into openFrameworks.
Amazon Verified review Amazon
Dolores Joya May 13, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book covers a build up of project work which is closer to a real application of the knowledge. Denis covers a lot of the more sought after techniques in this book. I've read Denis Perevalov's first book Mastering openFramewoks: Creative Coding Demystified and was quickly on my feet with OpenFrameworks. I did a little research and discovered he has taught this subject for several years and his teaching style comes through. I would read openFrameworks Essentials to get the feel of building a full project and read Mastering OpenFrameworks for a walk-thru or reference for what OpenFrameworks can do.
Amazon Verified review Amazon
cloud_canvas Aug 08, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I cannot praise this book highly enough. The project you build looks awesome, and the extent they take you to with adding all kinds of common hooks into it (LFOs for modulation, OSC hooks, reading serial values from a microcontroller) are incredibly useful for every type of creative coding project... these are things that I need to do all the time.Make sure to save a zip of your project at the end of Chapter 3 like they tell you to do. Even though it only comprises about 40 pages towards the end of the book, there's a final sprint of executing a diminutive version of the final project on literally every single platform that oF can handle that's exhilarating!This book covers everything it should in the best way possible with the most satisfying result. I am VERY impressed, and I can't wait to tie into the authors' other openFrameworks book.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.