danomatika’s portfolio | Pitt OpenFrameworks workshop

Openframeworks is an open source toolkit designed to support the creative process by providing a simple and intuitive framework for experimentation. Wrangling software libraries and building project files saps the creative juices. OF wraps up a number of popular and useful libraries into a single C++ environment for working with graphics, images, audio, video, and computer vision in the realm of interactive art, design, and data visualization.

  • Tired of building C++ projects from scratch? Simply copy a template or example and hack away.
  • Need some way to work with physics, networking, databases, serial devices or other equipment?
  • Want to deploy an application on multiple platforms? OF currently supports Win, Mac, Linux, iOS, and (soon) Android.

Simply put, don’t waste time reinventing the wheel when you can hit the ground spinning!

This 2 day workshop is intended to familiarize you with the layout and methodology of Openframeworks. We will help you get your build setup working and jump into the api through a number of example applications. By the end, you will be able to start creating your own software experiments. Join a growing community of artists, hackers, researches, and hobbyists that are utilizing Openframeworks as an efficient creative outlet.

Where: Room 501 at the U of Pitt School of Information Sciences (135 N. Bellefield Ave.)

When: 10a-6p Dec 2-3

Requirements

Some projects made with OpenFrameworks

Quick References

Overview of OpenFrameworks

How to Install

Download the latest version (currently 007) of OpenFrameworks from http://www.openframeworks.cc/download and choose the package for your OS/compiler.

Extract the zip file wherever you want.

Optionally, you can clone OF from the Git repository on Github. Do a clone and checkout a specific version as a tag:

git clone git://github.com/openframeworks/openFrameworks.git
git checkout 007 

Folder Layout

Openframeworks comes as a self-encapsulated build environment within a single folder. Source code, compiled libraries, and applications are all built using relative paths in order to lessen some of the headache of adding/maintaining project search paths. This means it is very important to place addons and new projects in the correct place within this structure, otherwise files may not be found when you try to build your shiny new idea!

The main layout is as follows:

  • addons: OF external libraries aka ofx*
  • apps: application projects go here
    • examples: examples for basic OF functionality
    • advancedExamples: more advanced OF functionality (threading, etc)
    • addonsExamples: examples for the addons included with OF (ofxOpenCv, etc)
    • myApps: important! create this folder for your apps!
  • libs: the core OF source and bundled libraries
  • scripts: useful scripts for setting up/working with OF (install dependencies on Linux, etc)

You should not need to mess with anything except for placing new addons into the addons folder and creating your own application projects in the apps folder.

Important! All application projects must be 3 levels deep within the main folder structure!

Putting app project files at:

apps/myApps/MyAwesomeProject
or
apps/dan/anotherProject

will work fine. However the following will result in non-building projects and frustration:

apps/MyAwesomeProject
or
apps/myApps/dan/MyAwesomeProject

Make sure to double check this every time you create a new project.

App Layout

A basic OpenFrameworks application consists of the following files and folders within a single application folder:

  • various project files (Xcode, Visual Studio, Codeblocks, a Makefile, etc)
  • bin: your compiled app and supporting libraries end up here
    • data: where to put your app resources (images, sounds, xml settings files, etc)
  • src: the project’s source code
The src folder usually contains:
  • main.cpp: program entrance point, where the testApp is launched
  • testApp.h: application class header, declare functions and variables here
  • testApp.cpp: application class implementation, where most of the work takes place

OF App Programming

A single main function in main.cpp is the entrance point for the entire program. This is where the graphics window is initialized (set the size, fullscreen?) and the testApp class is launched by ofRunApp.

The testApp class is derived from an ofBaseApp and is where all of our programming will take place. It consists of the following main member functions which are called automatically by OpenFrameworks:

  • setup: called once at startup, initialize variables and load resources here
  • update: called once per draw frame, do update calculations here
  • draw: called once per draw frame, draw graphics to the screen here
  • exit: called once on app exit, destroy/cleanup resources here
  • keyPressed, keyReleased: called whenever a key is pressed
  • mousePressed, mouseReleased, mouseMoved, mouseDragged: called whenever a mouse moves and/or a mouse button is pressed/released