Configs2026年4月15日·1 分钟阅读

openFrameworks — Open-Source C++ Toolkit for Creative Coding

openFrameworks (oF) is a C++ toolkit for creative coding: interactive installations, generative art, computer vision, real-time video. Used by artists, researchers, and production studios worldwide for the past two decades.

Introduction

openFrameworks (oF), begun in 2005 by Zach Lieberman and Theo Watson, is the C++ sibling of Processing — created when artists and researchers needed Processing's philosophy but with C++ performance for computer vision, video processing, and real-time installations.

With over 10,000 GitHub stars, openFrameworks is used by Universal Everything, UNIT9, OFFF conference visuals, Kimchi and Chips, Marshmallow Laser Feast, and many installation artists + research labs. Its OpenGL-backed rendering + hundreds of addons make it the de-facto C++ toolkit for creative technologists.

What openFrameworks Does

oF provides a C++ header/library for graphics (2D + 3D via OpenGL), video (GStreamer / AVFoundation), audio (RtAudio / OpenAL), image processing (including ofxOpenCv, ofxCv), networking, serial, OSC, MIDI, and hundreds of community addons (ofxAddon convention) for everything from Kinect to laser DACs to machine learning.

Architecture Overview

Your C++ sketch (ofApp)
  setup() / update() / draw()
  keyPressed() / mouseMoved() / ...
      |
[openFrameworks core]
   ofGraphics (OpenGL), ofImage, ofVideoPlayer, ofSoundPlayer,
   ofMesh, ofShader, ofFbo, ofTrueTypeFont
      |
[Math + utils]
   ofVec, ofPath, ofRandom, ofMap, ofMatrix,
   ofNoise (Perlin), ofColor
      |
[Addons (ofxXxx)]
   ofxOpenCv / ofxCv, ofxGui, ofxOsc, ofxKinect,
   ofxMidi, ofxSyphon, ofxSpout, ofxOscillator, 300+ more
      |
[Platform backends]
   macOS, Windows (VS / MSYS2), Linux, iOS, Android, Emscripten, RPi

Self-Hosting & Configuration

// ofApp.h — with addons
#pragma once
#include "ofMain.h"
#include "ofxOpenCv.h"
#include "ofxGui.h"

class ofApp : public ofBaseApp {
public:
    void setup() override;
    void update() override;
    void draw() override;

    ofVideoGrabber cam;
    ofxCvColorImage colorImg;
    ofxCvGrayscaleImage grayImg, grayBg, grayDiff;
    ofxCvContourFinder contours;
    ofxPanel gui;
    ofParameter<float> threshold{"threshold", 80, 0, 255};
};

// ofApp.cpp
void ofApp::setup() {
    cam.setup(640, 480);
    colorImg.allocate(640, 480);
    grayImg.allocate(640, 480);
    grayBg.allocate(640, 480);
    grayDiff.allocate(640, 480);
    gui.setup();
    gui.add(threshold);
}

void ofApp::update() {
    cam.update();
    if (cam.isFrameNew()) {
        colorImg.setFromPixels(cam.getPixels());
        grayImg = colorImg;
        grayDiff.absDiff(grayBg, grayImg);
        grayDiff.threshold(threshold);
        contours.findContours(grayDiff, 20, (640*480)/3, 10, false);
    }
}

void ofApp::draw() {
    grayDiff.draw(0, 0);
    contours.draw(0, 0);
    gui.draw();
}

Key Features

  • Processing-like API, in C++ — shallow curve, deep ceiling
  • Graphics — 2D + 3D OpenGL, shaders, FBOs, post-processing
  • Video + audio I/O — cameras, files, network streams, mics, speakers
  • Addons ecosystem (ofxXxx) — 300+ community libraries
  • Cross-platform — macOS, Windows, Linux, iOS, Android, RPi, web (emscripten)
  • Performance-first — pure C++ where you need tight real-time loops
  • Artist-friendly examples — hundreds of shipped example sketches
  • Project Generator — scaffold new projects across IDEs in one command

Comparison with Similar Tools

Feature openFrameworks Processing (Java) Cinder vvvv TouchDesigner
Language C++ Java C++ Visual node editor Visual node editor
Rendering OpenGL OpenGL OpenGL DX11 Vulkan / DX12
Performance Very high Moderate Very high High Very high
Addons 300+ Rich Smaller Built-in modules Built-in modules
Commercial Free Free Free Free (paid options) Paid ($)
Best For Installations + CV + production Education + sketching High-end C++ installations Node-graph artists Commercial visual pipelines

FAQ

Q: openFrameworks vs Cinder? A: Both C++, both OpenGL. openFrameworks is more artist-friendly and has a larger addons ecosystem. Cinder is more modern C++ style (ranges, lambdas) and sometimes preferred by experienced C++ engineers. Pick based on community + addons needed.

Q: Is C++ necessary? A: If you need real-time CV, 3D rendering with custom shaders, or ultra-low-latency interaction, yes. For sketching, p5.js or Processing are easier and usually sufficient.

Q: How do addons work? A: Drop an ofxAddon folder into of/addons/, re-run the Project Generator, and it's included. The standard convention makes community sharing easy.

Q: Is it maintained? A: Yes — 0.12.x released in 2024. Development pace is moderate (mostly by volunteer artists + researchers), but the codebase is stable and production-proven for 20 years.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产