Skip to content

paulobarcelos/ofxPatches

Repository files navigation

ofxPatches

ofxPatches is a small visual patching system for openFrameworks. It lets you build a live image-processing pipeline out of shader effects, connect patch outputs to patch inputs, tweak parameters with ofxGui, and save the graph as XML so a sketch can come back exactly as you left it.

It was built as a practical tool for sketching interactive video systems: chroma keying, masks, feedback, thresholding, blurs, blends, and quick experiments where editing a graph is faster than recompiling a chain by hand.

Status

The addon is being refreshed for current openFrameworks after a long quiet stretch. The examples build and run on macOS with openFrameworks 0.12.1, but this is still a hands-on creative-coding tool rather than a polished node editor. Use the examples as working references and expect to spend a little time with the patch graph.

Features

  • Runtime patch graph for chaining visual effects.
  • XML save/load for patch layout, parameters, and connections.
  • Built-in source patches plus common operations from ofxFX.
  • Patch previews and editable connection handles.
  • Example graphs for chroma keying and background subtraction.

Installation

Clone this addon into your openFrameworks addons folder:

cd /path/to/openFrameworks/addons
git clone https://github.com/paulobarcelos/ofxPatches.git

Install the external addon dependencies in the same folder:

git clone https://github.com/paulobarcelos/ofxFX.git
git clone https://github.com/paulobarcelos/ofxHomography.git

ofxGui and ofxXmlSettings ship with openFrameworks. For openFrameworks 0.12.1, use the Paulo Barcelos ofxFX fork above; it carries the small compatibility fix needed by the current examples.

In your project addons.make, include:

ofxFX
ofxGui
ofxHomography
ofxPatches
ofxXmlSettings

Examples

example-ChromaKey loads a saved graph that combines camera input and movie.mov through a mask and blend chain. It is the best place to see the patch UI and XML graph loading in action.

example-BackgroundSubtraction builds a camera-based background subtraction graph with accumulation, difference, morphology, blur, thresholding, and masking.

Both examples are capped at 30 fps and have individual patch previews disabled in the saved settings to keep the graph responsive on modest machines. Release builds are strongly recommended for manual patch editing.

cd example-ChromaKey
make Release
make RunRelease

Basic Use

The manager setup order matters:

manager.setup(numberOfSources);
manager.allocate(width, height);
OFX_PATCHES_REGISTER_ALL_EFFECTS(manager);
manager.loadSettings();

In update(), set the source textures and update the manager when there is a fresh frame:

if(cam.isFrameNew()){
    manager.setTexture(cam, 0);
    manager.update();
}

In draw(), draw the patch UI:

manager.drawGUI();

Use the manager's save/load buttons to persist the current patch graph.

Performance Notes

Each active patch owns FBOs and runs its shader passes when the manager updates. Dense graphs can be heavy, especially in Debug builds or under system memory pressure. If the UI feels sluggish, try a Release build, lower or disable patch preview scales, cap the app frame rate, and keep the patch graph in edit mode only while wiring.

Compatibility

Tested on June 1, 2026 with openFrameworks 0.12.1 on macOS. Earlier releases were tested with openFrameworks 0.11.2.

Current builds still produce warning noise from openFrameworks, utf8, and older ofxFX APIs on modern Clang. The warnings do not block the examples. On the current test machine, example-BackgroundSubtraction also logs one OpenGL sampler warning on launch and then continues running.

Version History

Version 1.3.0 (2026.06.01)

  • Refreshed the examples for openFrameworks 0.12.1.
  • Added the missing ofxHomography dependency to the example addon lists.
  • Fixed saved graph loading so patch input connections are restored onto the correct patch.
  • Saved connection slots explicitly while preserving compatibility with older graph XML.
  • Prevented manual self-connections in the patch UI.
  • Connected the ChromaKey example manager output to the final blend patch.
  • Disabled per-patch previews in the example settings and capped the examples at 30 fps for a friendlier editing experience.
  • Fixed several modernization issues in patches, XML loading, memory cleanup, and texture access.

Version 1.2.0 (2021.05.19)

  • Added the Kaleidoscope patch.

Version 1.0.1 (2021.05.19)

  • Added the correct ofxFX dependency.

Version 1.0.0 (2021.05.19)

  • Adapted to the official addons template.
  • Cleanup.

License

MIT. See license.md.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors