Skip to content

Nannou Workshop

Joshua Batty edited this page Jun 7, 2018 · 11 revisions

Introduction

The Nannou Creative Coding Framework is a collection of code aimed at making it easy for artists to express themselves with simple, fast, reliable, portable code. Whether working on a 12-month laser installation or a 5 minute sketch, this framework aims to give artists easy access to the tools they need. Nannou was created by MindBuffer for this purpose and released as open source in the hope it can be useful to other artists and technologists.

Why Rust?

Rust is a language that is both highly expressive and blazingly fast. Here are some of the reasons why we choose to use it:

  • Super fast, as in C and C++ fast.
  • A standard package manager that makes it very easy to handle dependencies and share your own projects in seconds.
  • Highly portable. Easily build for MacOS, Linux, Windows, Android, iOS and so many others.
  • No header files (and no weird linking errors).
  • Sum Types and Pattern Matching (and no NULL).
  • Local type inference. Only write types where it matters, no need to repeat yourself.
  • A more modern, ƒunctional and expressive style.
  • Memory safe and data-race-free! Get your ideas down without the fear of creating pointer spaghetti or segfault time-sinks.
  • Immutability by default. Easily distinguish between variables that can change and those that can't at a glance.
  • Module system resulting in very clean and concise name spaces.
  • One of the kindest internet communities we've come across (please visit mozilla's #rust or /r/rust if you're starting out and need any pointers)

Topics Covered in this Workshop

Basic

  • Brief overview or Rust, goals, benefits and differences to other languages
  • Getting setup with VS-Code and installing the correct plugins to use for Rust
  • Cargo and Crates.io
  • Basic rust primitives
  • Void and return functions
  • Rust documentation
  • Cargo doc for automatically generating documentation for your project
  • Examples for graphics, audio, communication (OSC, Artnet), gui

Advanced:

  • Types and Modules
  • Safety and Immutability by default
  • Generating FFI code to link C++ libraries
  • Cross compilation

Upcoming Nannou Development:

  • Advanced graphics (Shaders, FBOs, Vulkan, GP-GPU, RLSL)
  • Gantz Graph
  • User Interface builder

Getting Started

Nannou is built using the Rust programming language. Thus, the first step is to download and install Rustup on your machine.

Install Rust

To install rust, open up the terminal, copy and paste the below text into the terminal and hit enter.

curl https://sh.rustup.rs -sSf | sh

Please see this link if you would like more information on the installation process.

VS Code

We recommend using VS-Code as your editor and IDE for Nannou development. Currently it seems to have the best support for the Rust language including syntax highlighting, auto-complete and code formatting etc... It also comes with a handy integrated unix terminal and file navigation system. Below are steps we recommend for getting started with Nannou development using VS-Code.

  1. Download VS-Code for your OS.
  2. Install RLS plugin for VS-Code
  3. Open a Nannou project (File > Open Folder...). Open the folder for the whole project (i.e., the folder containing 'Cargo.toml'), not the 'src' folder.
  4. Click on the 'view' menu and select 'integrated terminal'

Other IDE's

Although we recommend VS-Code, it is also possible to configure the following development environments.

  1. Sublime Text
  2. Atom
  3. Intellij IDEA
  4. Vim
  5. Emacs
  6. Visual Studio
  7. Eclipse (No longer maintained)

Examples

  • Basics folder examples
  • Events and how the Nannou Model compares to openFrameworks / Processing
  • Simple draw
  • Builder patterns
  • Simple Gui
  • Simple Audio
  • Simple OSC communication
  • Nature of Code examples (go through some examples with the Processing code side by side)
  • Generative Gestaltung
  • Etherdream and Laser output
  • Nannou new
  • Artnet to Capture ---- Everyone make a basic patch -----
  • FFI
  • Demo (Audio Server, Jen)

Further Resources: