Openframeworks Essentials - Sample Chapter
Openframeworks Essentials - Sample Chapter
ee
Sa
pl
openFrameworks Essentials
openFrameworks Essentials is a guide that can be used to learn and use
openFrameworks in order to develop creative and artistic real-time applications.
The book contains an insight into how openFrameworks can be used to implement
your creative ideas in powerful projects by working on the OS X, Windows, Linux,
iOS, Android, and Raspberry Pi devices. Although openFrameworks is a very popular
toolkit for creative coding, the number of books describing openFrameworks is not high.
This book is a fast-paced tutorial that begins with installing openFrameworks and
then takes a step-by-step approach towards using openFrameworks to build a video
synthesizer project. We will investigate and implement features such as 2D and 3D
graphics, GUI, shaders, and reaction on sound, using the OSC networking protocol
and Arduino.
The openFrameworks version considered is 0.8.4.
Chapter 7, Distributed and Physical Computing with Networking and Arduino, explains
how to control your project from other programs using the OSC networking protocol. It
describes building such controlling programs using openFrameworks by itself as well as
the Python and Max/MSP programming languages. Also, it covers receiving data from
an Arduino device.
Chapter 8, Deploying the Project on iOS, Android, and Raspberry Pi, guides you
to run the light version of the developed video synthesizer on mobile and Raspberry
Pi devices.
Chapter 9, Further Resources, suggests the direction to further enhance the video
synthesizer project, provides sources of additional information on openFrameworks,
and discusses debugging and speeding up openFrameworks projects.
Appendix A, Video Synthesizer Reference, is a comprehensive documentation
of the developed video synthesizer project. It contains a description of all GUI
controls, control keys, and media files used by the project.
Appendix B, openFrameworks Quick Reference, is a useful reminder
of the basic openFrameworks functions and classes used in the book.
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:
[ 13 ]
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.
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.
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.
[ 14 ]
Chapter 1
[ 15 ]
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.
[ 16 ]
Chapter 1
[ 17 ]
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.
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 modulesvideo generators, video
players, video effects, and video mixersconnected to each other. Our synthesizer
will include all these basic modules and will have the following structure:
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)
[ 18 ]
Chapter 1
2D
Video mixer
and
video effect
3D
Chapter 2
Chapter 4
Chapter 5
Screen
GUI
LFO,
sound analysis,
and text file
Networking
and
Arduino
Chapter 3
Chapter 6
Chapter 7
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.
[ 19 ]
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.
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.
[ 20 ]
www.PacktPub.com
Stay Connected: