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

Creating the video effect with a shader


Now, we will demonstrate processing a video using shaders. We do it by implementing the well-known kaleidoscope effect. This effect is quite generic, and its implementation exhibits many things that you would need to create your own effects with shaders.

Note

Shaders are tiny programs executed on GPU (video card). A video effect implemented with shaders works faster than its CPU-based analogue. This is the reason for shaders for being the most popular technology for creating real-time video effects.

Shaders are written in the GLSL language. It is a specialized version of the C language, containing a number of built-in functions and variables.

There are several types of shaders, including vertex, fragment, and geometry shaders. Here, we are interested in a shader that allows us to change the colors of the drawn pixels. The most appropriate shader type for such a task is fragment shader. Such a shader is executed by the video card to process each pixel right...