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

Chapter 4. Working with Raster Graphics – Images, Videos, and Shaders

In the previous chapters, we dealt with 2D graphics made exclusively from geometric primitives. This kind of graphics is called vector graphics and is great for generating algorithm-based pictures. Drawing and manipulating pictures of real-world objects requires other 2D graphics called raster graphics, which is based on raster images.

In this chapter, we will consider the basics of raster graphics by covering the following topics:

  • Loading and drawing raster images and videos

  • Grabbing and drawing live video from a camera

  • Mixing images using additive blending

  • Drawing to the offscreen buffer

  • Processing images using fragment shaders demonstrated by implementing the kaleidoscope effect.

At the end of the chapter, we will have our video synthesizer extended with raster graphics capabilities, including mixing images, video files, and live video from a camera, and processing the resulting picture with the kaleidoscope effect.