Book Image

Processing 2: Creative Programming Cookbook

Book Image

Processing 2: Creative Programming Cookbook

Overview of this book

Processing is probably the best known creative coding environment that helps you bridge the gap between programming and art. It enables designers, artists, architects, students and many others to explore graphics programming and computational art in an easy way, thus helping you boost your creativity. "Processing 2: Creative Programming Cookbook" will guide you to explore and experience the open source Processing language and environment, helping you discover advanced features and exciting possibilities with this programming environment like never before. You'll learn the basics of 2D and 3D graphics programming, and then quickly move up to advanced topics such as audio and video visualization, computer vision, and much more with this comprehensive guide. Since its birth in 2001, Processing has grown a lot. What started out as a project by Ben Fry and Casey Reas has now become a widely used graphics programming language. Processing 2 has a lot of new and exciting features. This cookbook will guide you to explore the completely new and cool graphics engine and video library. Using the recipes in this cookbook, you will be able to build interactive art for desktop computers, Internet, and even Android devices! You don't even have to use a keyboard or mouse to interact with the art you make. The book's next-gen technologies will teach you how to design interactions with a webcam or a microphone! Isn't that amazing? "Processing 2: Creative Programming Cookbook" will guide you to explore the Processing language and environment using practical and useful recipes.
Table of Contents (18 chapters)
Processing 2: Creative Programming Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Installing libraries


The core functionality of Processing is very basic. This was done by design, to make it easy for everyone to get started using it. If you need to do something that's not available in Processing, you can use a library that adds the functionality you need. One of the new features in Processing 2 is the Library Manager. This allows you to install new libraries in the easy way.

Getting ready

There is an overview of the available Processing libraries on the Processing website at http://processing.org/reference/libraries/. You'll find the documentation of the libraries included with Processing and a list with contributed libraries. There are libraries to work with 3D, computer vision, geometry, and a lot more.

How to do it...

You can open the library manager by using this menu: Sketch | Import Library… | Add Library…. This will give you a list of available libraries. To install the library you need to select it from the list and click on the Install button. Processing will install the library in the libraries folder of your sketchbook.

Unfortunately, not all libraries are included in this list. Some of the older libraries will probably still work in Processing 2, but the developer might not have added the new functionality to install the library through the Library Manager. In that case, you'll need to install the library manually. Don't worry; this is not as hard as it sounds.

You should download the library from the website of the developer and unzip it. Drag this folder to the libraries folder inside your sketchbook. Libraries are structured in a (predefined) way. If the library is not structured like this, it won't work. The main library folder usually contains four subfolders: examples, library, reference, and src. The examples folder contains Processing sketches the developer made to show how the library works. The library folder contains the compiled library code that will be imported into your sketch. The reference folder stores the documentation on how to use the library. The src folder contains the source code of the library. This might be handy for advanced users to learn how the library works and modify it as per their needs.

How it works...

The folder structure for libraries is important for Processing to find the library. The main folder for the colorLib library is named colorLib. Inside the library folder within that directory, you'll find a file named colorLib.jar. This JAR file will be included in your applet or application when you export your sketch. You can add import libraries into your sketch by going to the Sketch | Import Library… menu and select the library you want.