This is a really short introduction about what creative coding is, and I'm sure that it is possible to find out much more about this topic on the Internet. Nevertheless, I will try to explain how it looks from my perspective.
Creative coding is a relatively new term for a field that combines coding and design. The central part of this term might be the "coding" one—to become a creative coder, you need to know how to write code and some other things about programming in general. Another part—the "creative" one—contains design and all the other things that can be combined with coding.
Being skilled in coding and design at the same time lets you explain your ideas as working prototypes for interface designs, art installations, phone applications, and other fields. It can save time and effort that you would give in explaining your ideas to someone else so that he/she could help you. The creative coding approach may not work so well in large projects, unless there are more than one creative codes involved.
A lot of new tools that make programming more accessible have emerged during the last few years. All of them are easy to use, but usually the less complicated a tool is, the less powerful it is, and vice versa.
Cinder is one of the most powerful tools in the world of creative coding. In this chapter, we will learn what Cinder is and how to set it up on the two most popular operating systems—Mac OS X and Windows. If you have access to both and you want to do it as fast as possible, choose Mac OS X. It won't take much longer on Windows, if you have a good Internet connection.
So we are up to some Cinder coding! Cinder is one of the most professional and powerful creative coding frameworks that you can get for free on the Internet. It can help you if you are creating some really complicated interactive real-time audio-visual piece, because it uses one of the most popular and powerful low-level programming languages out there—C++—and relies on minimum third-party code libraries. The creators of Cinder also try to use all the newest C++ language features, even those that are not standardized yet (but soon will be) by using the so called Boost libraries.
Ok, less talk, do more! Point your browser to the Cinder website (http://libcinder.org).
Cinder for Mac OS X (Mac OS X)
Cinder for Visual C++ 2010 (Windows)
Now we are going to split the Cinder setup in two groups: Mac OS X and Windows. This is because of the configuration process, which is a bit different for each platform. You will get up and running faster if you use Mac OS X, but it is not blamable in case you appear to use Windows—just get yourself a good Internet connection and you are good to go!
Setting up Cinder on Mac OS X is relatively easy if you have done some coding before—that means, if you have Xcode installed. If not, you have to download and install it. To do that get yourself an Apple Developer Account from https://developer.apple.com/programs/register/.
Once you have your Apple Developer ID and password, go to the Xcode download section at https://developer.apple.com/xcode/ or open up the App Store application and search for the Xcode application there.
The process of installing Xcode is not a topic that we will be covering in this book, but it should be quite self-explanatory as Apple has a long history of making their applications as user friendly as possible. If you encounter problems with installing Xcode, try Google or go to the official Apple Developer Xcode FAQ located at https://developer.apple.com/support/xcode/.
So now you have Xcode installed on your computer! Let's move on and unarchive the downloaded Cinder package at a safe location, for example,
/Users/Your_User-name/cinder. In my case, the path is
Next, we are
going to test if our newly created setup is working by opening one of the sample applications. We will try out the QuickTime sample application. To do that open the file
QuickTimeBasic.xcodeproj in Cinder 0.8.5) in the
cinder/samples/QuickTime/xcode/ directory (
cinder/samples/QuickTimeBasic/xcode/ in Cinder 0.8.5). In Xcode, select Build | Build and Run (Product | Run on Xcode 4+). You can achieve the same effect by pressing Cmd + R or by clicking on the Build and Run (simply Run in Xcode 4+) button in the toolbar (you can recognize it by a round green play button that is placed over a grayscale hammer or a round gray play button in Xcode 4+).
An Open File dialog should pop up. Go and select a movie file from your hard drive!
If you see the movie playing back in a window, success! You are ready to move on to the next chapter. If not, try to follow the steps mentioned in this section more carefully—maybe you did not notice something.
Setting up Cinder on Windows might take a bit longer than on Mac OS X. That does not mean that it will work slower though. The thing that is good about Windows PCs is that you can usually be more elastic with your hardware configuration. So, if you have a strong will to create some wicked generative stuff with the right kind of hardware you choose, go for Windows and equip yourself with some QuadCore CPU, SSD hard drive, and appropriate GPU. It won' t hurt.
The main reason why configuring Cinder in Windows takes more time is that you'll have to download more stuff. Except the Cinder package, you also have to download and install the following.
The reason of choosing this IDE is that all the official Cinder sample application projects are created for this one. Here we will use Microsoft Visual C++ as it is the default Windows IDE chosen by Cinder creators.
To download Microsoft Visual C++, point your browser at http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express.
Click on Visual C++ 2010 Express tab, choose the language to be downloaded, and click on Install. A download should start and when it is finished, open the
We will not cover the whole installation process, as it is not the scope of this book. Just choose the default options for everything and it will be fine. Let's move on to the next component we still need.
We need this software development kit (SDK) in order to communicate our programs with the Windows system. The Cinder framework will do it for us, so we won't see anything Windows specific—just multiplatform Cinder specific. Don't be afraid and download the Windows Platform SDK from http://bit.ly/IL35OV.
When the download is complete, do run it! Choose default options everywhere again and everything should be ok.
We need this because Cinder audio core relies on it. So let's get it from http://bit.ly/OSe24s.
Install with the default settings and you are good to continue.
You will have to get an Apple Developer Account to download it. Get it from https://developer.apple.com/programs/register/.
Then go to https://developer.apple.com/quicktime/.
Be careful while
installing it. Cinder expects that QuickTime SDK resides in the same directory level (and with the directory name
QuickTimeSDK-7.3) as Cinder itself. So, if you keep your Cinder in
C:\cinder, the QuickTime SDK should reside at
C:\QuickTimeSDK-7.3—change this while installing the SDK.
When you come to a point in the installation where you can choose the destination folder, click on the Change button.
Now change the Destination Folder path to
Before launching your first sample application, make sure that you have QuickTime Player installed on your system. If not, go to http://www.apple.com/quicktime/download/, download, and install it.
Go to the Cinder samples directory, for example,
C:/cinder/samples/ and find a folder with the name QuickTime. Open
Downloading the color images of this book
We also provide you a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output.
You can download this file from:
Welcome to Microsoft Visual C++ 2010! Press F5 to build a project and run it. You should be provided with a prompt to choose a file—select a QuickTime compatible movie file from your hard drive and see what happens. You should see the movie playing back, and a semi-transparent rectangle with different stats about the movie file over it.
If you don't see the movie, check if you have QuickTime Player installed. First time I tried this sample application, I didn't succeed. And I spent hours trying to understand, what's wrong? Nothing! You just don' t have QuickTime Player. Get it from http://www.apple.com/quicktime/download/.
To sum up, these are the most simplest and fastest ways you can get Cinder up and running. There are other possible ways too, but they are out of the scope of this book. But if you search for the latest version of Cinder, check the CINDER + GIT section on the Cinder official website (http://libcinder.org/docs/welcome/GitSetup.html).
In the next chapter, we will try to understand what is possible with Cinder by launching different samples in the Cinder samples package.