Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
Text broadcast of CppCast 281: Creative…

Text broadcast of CppCast 281: Creative coding

Mar 17 2021
Author:

Episode 281 of CppCast was recorded on January 6th, 2021. Hosts Rob Irving and Jason Turner talked to Zach Lieberman, a professor at MIT's Media Lab, about Herb Sutter's 2020 Wrap-Up blog post and the ISO mailing from December, 2020. Then they discussed Open Frameworks, a C++ toolkit Zach co-created 10 years ago for creative coding, and various creative coding tools and techniques.

This episode of CppCast is sponsored by Visual Assist. The well-known productivity extension for Visual Studio, Visual Assist speeds up development with features like smart navigation, code inspection, and suggestions, powerful refactoring commands, and a whole lot more - even spellchecking in comments.

Start your free Visual Assist trial at wholetomato.com.

0813_cppcast-281/image1.png

Introduction

Rob: Welcome to episode 281 of CppCast. At the top of every episode we highlight a piece of feedback. We got this tweet from Matt Fernandez commenting on our recent episode with Patricia Aas: "Patricia's rant on this episode is all too relatable. So common to check out industry supported project and find multiple wheels unnecessarily reinvented." We also got a lot of articles about people who share her problems with trying to build Chromium.

Jason: Chromium. Yeah.

Rob: We'd love to hear your thoughts about the show. You can always reach out to us on Twitter, or email us at feedback@cppcast.com. And don't forget to leave us a review on iTunes or subscribe on YouTube.

Joining us today is Zachary Lieberman. Zach is an artist, researcher, and educator with a simple goal. He wants you surprised with his work. He creates performances and installations that take human gestures as input and amplifies them in different ways, making drawings come to life, imagining what the voice might look like if we could see it, transforming people's silhouettes into music. He's been listed as one of Fast Company's Most Creative People and his projects have won the golden Nica from Ars Electronica, Interactive Design of the Year from Design Museum London, as well as listed in Time Magazine's best inventions of the year.

0813_cppcast-281/image2.png

He creates artwork through writing software and as a co-creator of Open Frameworks, an open-source C++ tool kit for creative coding, and helped co-found and teaches at the School for Poetic Computation, a school examining the lyrical possibilities of code. He's also a professor at MIT's Media Lab, where he runs the Future Sketches group.

Zach, welcome to the show.

Zach Lieberman: Thanks. Super happy to be here.

Jason: There is so much to unpack in your bio. Let's start with MIT's Media Lab.

Zach Lieberman: The Media Lab has masters and PhD students. I've been an adjunct associate professor there for about the last two years, and have started a group there called Future Sketches. It's a master's program. This year I am accepting my first students.

Jason: Is there still time to apply if the listeners really love this podcast?

Zach Lieberman: Not for this year. The deadline was in December, but, certainly for future years.

Jason: So these interactive art displays, do you mean those that change the tiles or generate music as a response to movement?

Zach Lieberman: Sometimes. Often it responds to body movements or your position in space. That might be an entertainment situation where you're doing something.

Jason: Do these interactive displays that you've worked on use Open Frameworks?

Zach Lieberman: Yeah, I use Open Frameworks in most of the work I do.

Herb Sutter's 2020 wrap-up

Rob: First, we have a couple of news articles to discuss.

The first one is Herb Sutter's 2020 wrap-up which titles "Firsts in 2020 (or, A little dose of good news)". He highlighted a couple nice things that did go well in 2020. For example, the virtual meetings for the ISO committee have been going very well.

0813_cppcast-281/image3.png

He also highlighted that C++ 20 is the first release that made the standard smaller. Wound up taking 20 pages out of the standard. I thought that was significant.

Jason: If you go to any standard container, you will see: "Added in C++ 20: the spaceship operator; removed in C++ 20: all of the comparison operators."

So that's where it all came from – they removed all the comparison operators and replaced them with the spaceship operator.

Zach Lieberman: You know, I just got lost with the spaceship operator - clicked that link and got excited about it. I'm always happy when things get shorter.

Jason: Oh, yeah, I totally agree. I want to comment here that Herb points out that this is the first version of C++ that has all of the features that Bjarne outlined in his "Design and Evolution of C++" in 1994.

Zach Lieberman: Although he does say except for one minor feature.

Rob: Unified call syntax, which we'll probably never get. Yeah.

Jason: Unified function call syntax, for some people it's a big deal.

ISO mailings from December, 2020

Rob: The next thing is a collection of ISO mailings from December, 2020.

0813_cppcast-281/image4.png

They have one about having electronic straw polls to keep things moving forward virtually. Then there was another one – they are going to try to have an officially WG-21 managed chat service, because they don't want to use the C++ language Slack anymore.

Zach Lieberman: Those were the ones that I immediately went to, because I'm really interested in how organizations work in the age of COVID.

Jason: There were a few things that stood out to me. The first one was I just noticed is removing garbage collection support - that was added in C++11 and no compiler ever actually implemented it. The other one that stood out to me was std::filesystem::path_view.

As a side note, Ben Craig is continuing his work on the freestanding stuff and that has continued to grow. Freestanding is always interesting to me.

Creative coding

Rob: Okay. Zach, we highlighted a lot of things in your bio. To start off, maybe you could tell us a little bit more about what creative coding is.

Zach Lieberman: I would say creative coding means using software and electronics for making art. This may be writing code to make small executable files that do something interesting and bizarre and crazy graphically when you launch them.

And a lot of times it's a play with algorithms where you may take something like Voronoi algorithm, get excited about it, and see how you can use it in an art making context.

Often creative coding is working with software in order to create artistic expression.

Jason: That's an interesting definition to me, because I don't do painting or that kind of creative arts. I've always felt like programming itself is a creative outlet for me.

Zach Lieberman: Yeah, I dislike the term "creative coding" because it's almost implying that some other forms of coding are not creative. I've oftentimes felt like we needed a better term. However, if you say you do creative coding, people will understand it.

Jason: Some people I follow on Twitter share what they created with ShaderToy - and that's like completely different [from regular coding].

0813_cppcast-281/image5.png

Figure 1. A screenshot of the Elephant Ear Plants digital installation created by hsiangyun at shadertoy.com.

Zach Lieberman: I think that code is expressive, malleable, soft and adjustable - I think it's a really interesting vehicle for making things. In ShaderToy, people take code and modify it and modify it and modify it. They're having a conversation through software. The output are these really rich and different visual forms.

Jason: Could you explain for me and our listeners what ShaderToy is?

Zach Lieberman: Essentially, your GPU is a machine that turns triangles into pixels and draws them on the screen. There are several steps between code and pixels on the screen. They are called the pipeline. The steps include a Vertex shader step where you can alter geometry, there are also a fragment shader step and a step to alter pixels.

ShaderToy lets you write code at the pixel level and define how software will color a pixel.

If anyone is interested in shaders, I would recommend a book called "The Book of Shaders" by my former student Patricio Gonzalez Vivo.

Open Frameworks

Rob: Could you tell us a little bit about Open Frameworks?

0813_cppcast-281/image6.png

Zach Lieberman: Sure. Open Frameworks is an open-source C++ toolkit for artists and designers. It's been around for over 10 years. It's essentially a library that wraps a bunch of libraries and makes it easier to get started.

When you do creative coding, you often need to load an audio file or a font, draw something, get access to pixel data, or work with different assets, video, webcam, et cetera.

So we have wrapped such libraries and then we've come up with a simple API for you to interact with them.

We use OpenGL and we have a set up function and update function and a draw function.

The whole idea is that once you launch the app, it's just trying to draw as fast as possible and run your software, call, update and draw repeatedly. There's other models, but that's the model that we chose.

Rob: Could you give us a couple of examples of creative coding projects that are easy to make?

Zach Lieberman: One of the early Open Frameworks projects is a project called L.A.S.E.R. Tag. The project employed a bright projector, a bright potentially illegal laser, and a camera. As you drew with the laser, software tracked its movement and updated the image, and the projector projected the image on a building.

0813_cppcast-281/image7.png

Figure 2. Graffiti created as part of the L.A.S.E.R. Tag project.

Another project that I like is the one I did with New York Times. It was for an article about opioid addiction. The author interviewed hundreds of addicts and we hired a dancer to dance these quotes. Then I wrote software to process her movement and create graphics that express what these people were telling us.

Jason: What did those graphics ultimately look like?

Zach Lieberman: For example, for "Addiction", when you have to take the drug in order to maintain a baseline, I drew a very small figure, with these outlines around her, to demonstrate isolation.

0813_cppcast-281/image8.png

Figure 3. A screenshot that demonstrates addiction and isolation, from the project "A Visual Journey Through Addiction".

For the section called "Treatment" I designed particles that are bouncing along the body contour on the inside. And so you see a body, but the body is made of bouncing objects, almost like what happens when you take a medicine and try to imagine visually what that would look like.

Jason: Okay. All right.

Zach Lieberman: I do all kinds of things. On Instagram, I post daily sketches. These are short animations for poems and they're all made with C++ Open Frameworks.

0813_cppcast-281/image9.png

Figure 4. One of Zach Lieberman's daily sketches - "Color Meditation".

Jason: So it sounds like it has an aspect of computer vision to it.

Zach Lieberman: The main thing about Open Frameworks is that it is a creative coding toolkit and that it has wrappers for OpenCV and makes it easier to work with computer vision.

However, there are a number of creative coding toolkits. For example, Processing that was originally written in Java, p5.js that's a JavaScript version of that, and TouchDesigner that is popular now.

Jason: Awesome.

Zach Lieberman: What makes Open Frameworks powerful are all the available add-ons. The ofxAddons website has hundreds of add-ons. Let's say you're working on a project and you need to use some sort of sensor or library. There are people who have wrapped it in some form, and then you can add those wrappers to your project.

Rob: In your bio, you mentioned that you were the co-creator of Open Frameworks. Do you want to tell us what initially inspired you to create the toolkit?

Zach Lieberman: We have to go way back in time. I studied art and didn't have a ton of experience with computer programming. When I was really young, I did Logo.

When I graduated from undergraduate, I fell in love with Flash. Flash and ActionScript is how a lot of creative coders got started.

Then I went into Parsons for graduate school. I went to a design program and there people were working with the Macromedia Director program. It had this beautiful language called Lingo, which I still really love. So I learned Lingo. I learned Java.

After I graduated from Parsons, one of my professors there invited me to come and work with him. That first summer, he gave me a giant C++ book. And he said I needed to learn C++, because we were going to use it for this project. And the first summer after I graduated, we were doing projects at this place called Ars Electronica, which is a large electronic art festival in Linz.

And I was doing gnarly networking code and learning about UDP packets. And at that time we were using a library called ACU. This is not an open source library. It was developed at MIT.

After I graduated and I wanted to share with my students what we've learned. As artists, we were going out, we were making projects and I wanted to come back into the classroom and share code with them and show them, talk about computer vision. Talk about audio analysis. And we were using these closed source tools.

So Open Frameworks really started as a way to publish those things that we were learning and bring them into the classroom. And then the library grew as students tried to push it in different directions – MAC, Linux, Raspberry PI, iOS, Android.

Jason: Are those platforms actively maintained?

Zach Lieberman: Yeah, they are. Right now, for example, Apple released Silicon Macs and so we have to recompile a bunch of libraries.

Also, often I find that very helpful to be able to have the same code work across different platforms.

Rob: Very cool.

Jason: Is there any particular driving goal that Open Frameworks is working towards?

Zach Lieberman: The core of Open Frameworks when we started was very small. Then the core became larger and much harder to maintain. So now there's a real push to try to make the core smaller. We want to have more subsystems or more modules, pull them out of the core.

The next big thing is, OpenGL is in decline and we may have to figure out how to respond to more modern graphics API, be it Meadow or something else.

Jason: Right. Are you still actively involved in the development of Open Frameworks as the co-creator.

Zach Lieberman: I was very active in the past, less so now. I've been involved in some sort of subprojects. Then we had a community written book that I've helped with. I'm still really active when we have meetups and talk about strategy.

Jason: Is that a book that people wanting to learn more about Open Frameworks should go check out?

Zach Lieberman: Yeah, it's on the website.

Rob: That build tool you mentioned sounds interesting. Using that, how easy is it to get started in Open Frameworks?

Zach Lieberman: The Open Frameworks toolkit ships with a bunch of projects. There is an examples folder with over a hundred examples in there. The first step is to run one of the examples and take a look at it. Then the project generator tool should be pretty straightforward to get up and running.

One cool feature is that you can update recursively a bunch of projects. For example, you say, if this looks like an Open Frameworks project, update it and generate a new project file.

A tool like the project generator is designed to just make it easier, um, for you to be able to press play and see something.

Jason: Just to get a little more into the types of projects that someone could use to get started with Open Frameworks.

You mentioned this really cool example with the projector and the laser, but were there any other ones that you can kind of do on your own if you don't have any kind of special hardware?

Zach Lieberman: A lot of times people play with generative drawing techniques. There are add-ons for working with physics, things like box2d which is a really popular physics engine.

You might experiment with moving objects and seeing how they could bounce and collide.

I would recommend to beginners to look at projects that are made with Open Frameworks – on Instagram, Twitter, YouTube, Vimeo – and ask authors how they did them.

A lot of people share source code and ideas.

I also thought of a really nice Open Frameworks project and it's called Connected Worlds. It's at the New York Hall of Science and was created by Theo Watson and his partner Emily Gobeil. It is a really large interactive piece and it's about showing visitors how different elements in the world are connected. It's a large interactive room: there is a waterfall, you can put objects down on the ground, you can put logs on the floor and shape where the water goes, you can grow a tree. It's just a beautiful project.

0813_cppcast-281/image10.png

Figure 5. A photo from the Connected Worlds installation. Source: https://www.design-io.com/projects/connectedworlds.

Rob: I want to interrupt the discussion for just a moment to bring a word from our sponsor, Visual Assist. Visual Assist is used by serious C++ developers across the world. It's got great cogeneration. Do you need to implement methods from an interface? What about changing a pointer to a smart pointer?

Even an Unreal Engine smart pointer. Adding a symbol you've typed, but haven't declared? Visual Assist will do these and much more. Plus refactorings - more powerful than the ones included in Visual C++. Or detecting errors in code and suggesting useful corrections. Or navigation - helping you move anywhere in your code and open or locate what you need. Or even the debug extensions.

Visual Assist is written by C++ developers for C++ developers. Includes everything you need and nothing you don't. It has a low UI philosophy. It won't take over your IDE, but will show up when it's useful. It's there to help, not to advertise itself. Visual Assist is relied on by the developers building software you've used, whether that's office suites, operating systems or games. Software you use was built with Visual Assist.

Get the same tooling for your own development. Visual Assist supports Unreal Engine 4 and many versions of Visual Studio, including VS 2019 and Community. Get it at wholetomato.com.

0813_cppcast-281/image11.png

Just to bring it back to normal C++ stuff for a moment. You've been working on the Open Frameworks project for about 10 years.

What kind of version of C++ is it targeting? Have you kept up to date with new standards coming out?

Zach Lieberman: We're not on the cutting edge, but we definitely have gone through many iterations. For example, we used to lean heavily on a library called POCO, which gave us a lot of internal tools for dealing with threads and file system. We've been able to like move our way off of these libraries because of changes in C++. So it's not the most modern C++, but there are people who are pushing it and there's a lot of discussion about supporting different features and so on.

Rob: Do you want to tell us a little bit more about teaching artists and designers and how that relates to Open Frameworks?

Zach Lieberman: Sure. I taught for like over a decade at Parsons, which is a design school, and then I got tired of the university world.

So with some friends, I started a school called the School for Poetic Computation, which is an experimental school based in New York. And we've been around since 2013. Then about two years ago, I became a professor at MIT. So, teaching's really important to me.

I always say, when I try to describe what I do, I do sort of one-third artwork, one-third, teaching, one-third commercial work, and these are almost like three legs of a stool. I like these three things, because there's always something I can take. I take something that I learned from commercial practice and I bring it to the classroom. I take the energy from the students and I bring it to my art practice. I take the things from the art practice and bring it to my commercial practice. Those three things are really important.

In terms of teaching, I really love working with students who are new to code, who have never coded before, and are excited about the medium.

So I have a class which is called "Recreating the past". Every week I talk about a different artist or designer, for example, Vera Molnar. She's a Hungarian artist. Since the 1970s she's been doing pen plotter drawings. So she writes code and makes drawings with a pen plotter.

0813_cppcast-281/image12.png

Figure 6. Vera Molnar at her house in Paris. Photo courtesy: Galerie La Ligne. Source: https://muda.co/announcingveramolnar/.

Rob: I'm trying to remember what a pen plotter is.

Jason: It's old-school. If you wanted to print a CAD drawing, it would typically be the way to do it. It was X and Y axes and it would pick up a marker pen and draw it, then put that pen back and go grab the next pen and draw the next thing.

Zach Lieberman: So she [Vera Molnar] would do these amazing drawings through code. And my students learn about her work and then their homework assignment is to recreate one of her works, using modern tools. And I can give code examples in Open Frameworks, but they can use whatever tool they want. So some students might use Processing, they might use Unity, some may use Open Frameworks, but all the code examples I give them are in C++.

And they have to recreate a work. It's almost an act of reverse engineering where they look at an artwork that's created with code or has an algorithmic basis, take it apart, and recreate it. And then we talk about the differences between the original and the recreation. And those conversations that we have about those differences are really powerful, I think that they're an aspect of craft.

Or we'll do John Whitney who was an animator that gives us a chance to talk about trigonometry using Sonic cosine to animate. We'll talk about Muriel Cooper and her group at the Media Lab, doing some really interesting work with typography and computation. Kind of early days of using type on a computer.

And it goes on like that for about 10 weeks, which is every week talking about a different artist and then recreating their work.

Rob: Very cool. What is it like to teach these artists who don't necessarily have that much knowledge of programming. Is it easy to get them into C++ using Open Frameworks?

0813_cppcast-281/image13.png

Zach Lieberman: For students who have no background at all, we typically do a three- or four-day bootcamp, because vocabulary is very important. A lot of students will have some background, but maybe in another language. They might have done some JavaScript. They may have done, some Processing or some other environment and, you know, Python, et cetera.

But in general, I find the best thing is oftentimes with students, they just need to see examples. The thing that I always worry about is whether I can get the students to the point where they can ask.

If you're really lost, then you don't even know how to formulate the question. But if you get to the point where you're can say, I want to do this and I don't know how to, and I did this and this happened - and then it's really easy to write a short code snippet and send it back to them.

Jason: I was curious what the mix is like between engineering students who are interested in doing artistic expression and artists who are coming into your class.

I'm guessing you get a mix of these.

Zach Lieberman: Yeah, we get a mix. Some come from Silicon Valley and have extensive coding experience. One of the things that we try to do during the first week - we don't do anything on a computer. The first week we are completely analog, for example, we're doing drawing exercises.

During the first week I give a lecture about binary. I'll talk about how to count in binary, about the aesthetic implications of binary and about some artworks based on binary numbers. Then I ask students to build a teaching tool to teach someone binary. Once you start focusing on teaching tools and learning, students really start talking to each other. I like this idea of started starting without computers at all.

Rob: Since you just mentioned you like to teach without computers, is the school still running classes currently with the COVID pandemic?

Zach Lieberman: We had a really big problem in the spring time. We canceled the 10 week in-person program, and we've pivoted to doing online classes. And we had a very busy summer.

In the fall we've decided to put the programming on hold for now, because we are not really designed to handle many students. We have some internal things to figure out, for example, how teachers and staff and administration work together.

Rob: All right. Well, Zach, it's been great having you on the show. Is there anything you want to say before we let you go?

Zach Lieberman: If you're curious about Open Frameworks, jump in the forum, say hi, ask questions there. I'm really active on social media, on Instagram I'm zach.lieberman and on Twitter – @zachlieberman.

The website for the School for Poetic Combination is sfpc.io.

Rob: Thanks so much for listening in as we chat about C++. We'd love to hear what you think of the podcast. Please let us know if we're discussing the stuff you're interested in, or if you have a suggestion for a topic, we'd love to hear about that too.

You can email all your thoughts to mailto:feedback@cppcast.com. We'd also appreciate it if you can like and follow CppCast on Twitter. You can also follow me at robwirving and Jason at lefticus on Twitter. We'd also like to thank all our patrons who help support the show through Patreon.

If you'd like to support us on Patreon, you can do so at https://www.patreon.com/CppCast. And, of course, you can find all that info in the show notes on the podcast website at cppcast.com. The music for this episode was provided by podcastthemes.com.

Resources

Podcast

News

Links

Sponsors

Guest



Comments (0)

Next comments next comments
close comment form
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam