You are previewing Mastering openFrameworks: Creative Coding Demystified.
O'Reilly logo
Mastering openFrameworks: Creative Coding Demystified

Book Description

openFrameworks is the doorway to so many creative multimedia possibilities and this book will tell you everything you need to know to undertake your own projects. You’ll find creative coding is simpler than you think.

  • Create cutting edge audio-visual interactive projects, interactive installations, and sound art projects with ease

  • Unleash the power of low-level data processing methods using C++ and shaders

  • Make use of the next generation technologies and techniques in your projects involving OpenCV, Microsoft Kinect, and so on

  • In Detail

    openFrameworks is a powerful programming toolkit and library designed to assist the creative process through simplicity and intuitiveness. It's a very handy software library written in C++ to reduce the software development process, helping you to kick-start creative coding. With the help of C++ and shaders support, openFrameworks allows for the processing of all kinds of media information with your custom-developed algorithms at the lowest possible level, with the fastest speed.

    "Mastering openFrameworks: Creative Coding Demystified" will introduce you to a world of creative coding projects, including interactive installations, audio-visual, and sound art projects. You will learn how to make your own projects using openFrameworks. This book focuses on low-level data processing, which allows you to create really unique and cutting-edge installations and projects.

    "Mastering openFrameworks: Creative Coding Demystified" provides a complete introduction to openFrameworks, including installation, core capabilities, and addons. Advanced topics like shaders, computer vision, and depth cameras are also covered.

    We start off by discussing the basic topics such as image and video loading, rendering and processing, playing sound samples, and synthesizing new sounds. We then move on to cover 3D graphics, computer vision, and depth cameras. You will also learn a number of advanced topics such as video mapping, interactive floors and walls, video morphing, networking, and using geometry shaders.

    You will learn everything you need to know in order to create your own projects; create projects of all levels, ranging from simple creative-code experiments, to big interactive systems consisting of a number of computers, depth cameras, and projectors.

    Table of Contents

    1. Mastering openFrameworks: Creative Coding Demystified
      1. Table of Contents
      2. Mastering openFrameworks: Creative Coding Demystified
      3. Credits
      4. Foreword
      5. About the Author
      6. Acknowledgement
      7. About the Reviewers
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      9. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Downloading the color graphics PDF
          3. Errata
          4. Piracy
          5. Questions
      10. 1. openFrameworks Basics
        1. About openFrameworks
          1. Use cases
        2. Installing openFrameworks and running your first example
          1. Installing on Windows
            1. Microsoft Visual Studio
            2. Code::Blocks (Windows)
        3. Installing on Mac OS with Xcode
        4. Installing on Linux with Code::Blocks
        5. openFrameworks' folders
          1. The examples folder
          2. The apps folder
          3. The addons folder
        6. File structure of a project
        7. Code structure of a project
          1. main.cpp
          2. testApp.h
          3. testApp.cpp
            1. setup()
            2. update()
            3. draw()
            4. Other functions
        8. Creating a new project
          1. Creating a project from an existing example
          2. Creating a project using Project Generator
        9. Creating your first project – the Pendulum example
        10. Running the book's examples
        11. Basic utility functions
        12. Summary
      11. 2. Drawing in 2D
        1. Drawing basics
        2. The background color of the screen
          1. Pulsating background example
        3. Geometric primitives
          1. The simplest example of a flower
          2. Controlling the drawing of primitives
        4. Using ofPoint
          1. Operations with points
          2. Using control points example
        5. Coordinate system transformations
          1. Flower with petals example
        6. Colors
          1. Operations with colors
          2. Color modifications example
        7. Drawing with an uncleared background
        8. Using FBO for offscreen drawings
          1. Spirals example
            1. Playing with numerical instability
        9. Screen grabbing
        10. Additional topics
        11. Summary
      12. 3. Building a Simple Particle System
        1. The basics of particle systems
          1. Interaction types
          2. Computing particles' physics
          3. Rendering particles
          4. Creating a particle system – summary
        2. A single particle
          1. Control parameters
          2. Defining the particle functions
          3. Implementing a particle in the project
        3. An emitter
        4. The attraction, repulsion, and spinning forces
        5. Graphical user interface
        6. Additional topics
        7. Summary
      13. 4. Images and Textures
        1. Raster and vector images
        2. Loading and drawing an image
        3. Rotating images
        4. Color modulation
        5. Transparency
        6. Creating and modifying images
          1. Creating images
          2. Modifying images
            1. Working with the color of a single pixel
              1. A simple geometrical distortion example
            2. The functions for manipulating the image as a whole
        7. Using ofTexture for memory optimization
        8. Image warping and video mapping
        9. Using images for internal calculations
          1. An image as a mask
          2. An image as a palette
        10. Summary
      14. 5. Working with Videos
        1. Video basics
        2. Playing a video file
        3. Controlling the video playback
        4. Processing a single video frame
          1. The vertical lines image example
          2. The replacing colors example
        5. Processing multiple frames
          1. Radial slit-scan example
            1. Horizontal slit-scan
            2. Discussing color interpolation
        6. Processing a live video from the camera
          1. The video synthesizer example
        7. Using image sequence
          1. Using image sequence example
        8. Summary
      15. 6. Working with Sounds
        1. Sound basics
        2. Playing sound samples
          1. The bouncing ball example
          2. The singing voices example
        3. Generating sounds
          1. The PWM synthesis example
          2. Image-to-sound transcoder example
        4. Using a microphone
          1. The loop sampler example
            1. Saving a recorded sample to the file
        5. Getting spectral data from sound
          1. Dancing cloud example
        6. Summary
      16. 7. Drawing in 3D
        1. 3D basics
          1. Representation of 3D objects
          2. 3D scene rendering
        2. Simple 3D drawing
          1. The triangles cloud example
        3. Using ofMesh
          1. Enabling lighting and setting normals
            1. Computing normals using the setNormals() function
        4. Drawing sharp edges
        5. Drawing line segments and points
          1. Drawing line segments
          2. Drawing points
        6. Coloring the vertices
        7. Texturing
        8. Working with vertices
        9. The oscillating plane example
          1. The twisting knot example
        10. Additional topics
        11. Summary
      17. 8. Using Shaders
        1. Basics of shaders
          1. Types of shaders
          2. When to use shaders
        2. Structure of a shader's code
        3. A simple fragment shader example
          1. Creating the fragment shader
          2. The vertex shader
          3. Embedding shaders in our project
          4. Debugging shaders
        4. Creating video effects with fragment shaders
          1. Passing a float parameter to a shader
            1. A simple geometrical distortion example
          2. Passing the float array to the shader
          3. Using Perlin noise in shaders
            1. A liquify distortion example
          4. Processing several images
            1. A masking example
          5. An audio-reactive project example
        5. Deforming objects with a vertex shader
          1. Vertex shader
          2. Fragment shader
        6. Using vertex shader in our project
        7. Using a geometry shader
          1. The furry carpet example
        8. Additional topics
        9. Summary
      18. 9. Computer Vision with OpenCV
        1. Understanding computer vision and OpenCV
        2. Using ofxOpenCv
        3. Working with ofxCv images
          1. Image initializing
          2. Algebraic operations with images
          3. Drawing functions
          4. Access to pixels
          5. Working with color planes and color spaces conversion
          6. Motion detection from movies
          7. Discussing the algorithm's parameters
          8. Motion detection from live video
        4. Image filtering
          1. The image filtering example
        5. Geometrical transformations of images
          1. Perspective distortion removing example
        6. Searching for objects in an image
          1. Using the ofxCvContourFinder class for finding contours
          2. An example for searching bright objects in video
        7. Using OpenCV functions
          1. Optical flow
            1. Video morphing example
              1. Using optical flow for morphing
              2. Applying morphing to another image
        8. Summary
      19. 10. Using Depth Cameras
        1. Depth camera basics
          1. Active infrared stereo cameras
        2. Installing the ofxOpenNI addon
        3. ofxOpenNI examples
          1. Working with examples of depth images
          2. Hand-tracking examples
          3. User tracking examples
        4. Creating interactive surface
          1. Running the project
        5. Additional topics
        6. Summary
      20. 11. Networking
        1. Networking basics
        2. Using OSC protocol
          1. Sending data
          2. Receiving data
          3. Typical schemes of OSC usage
        3. Using TCP protocol for streaming images
          1. The streaming images example
        4. Summary
      21. A. Working with Addons
        1. Addons basics
          1. Addons in openFrameworks
          2. Installing a non-core addon
        2. Linking addons to a new project
          1. Using Project Generator
        3. Linking an addon to an existing project
        4. List of selected addons
        5. Summary
      22. B. Perlin Noise
        1. Perlin noise basics
        2. Using the ofNoise() function
        3. Space-coherent noise
        4. Summary
      23. Index