Book Image

OpenFrameworks Essentials

Book Image

OpenFrameworks Essentials

Overview of this book

Table of Contents (19 chapters)
openFrameworks Essentials
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Mixing layers using additive blending


At this point, we draw four graphical layers:

  • Image file

  • Video file

  • Video from camera

  • Geometric pattern generator (developed in two previous chapters)

The first three layers are simply drawn occluding each other. Only the fourth layer has control of its transparency (color a slider), so we can hide and show it back smoothly.

To control the visibility of the first three layers, let's create a video mixer. It will be a new GUI group, Mixer, consisting of three sliders, adjusting layers' transparencies. Additionally, we will draw the layers using a special mixing mode called additive blending. It's a mixing mode where drawing colors at each pixel are summed up to obtain the resultant picture.

Note

Additive blending models the behavior of physical light. Imagine that we output each layer to separate the physical projector. If we point all the projectors to one area on the wall, the resulting picture will be just the sum of all the projectors' lightings. This is...