openFrameworks addon for composing drawable objects in a small Flash-style display hierarchy.
Each ofxDisplayStackObject has its own position, scale, rotation, and color, and child objects inherit their parent transforms. It is useful for older sketches that want a lightweight scene graph without bringing in a larger animation or UI framework.
The name DisplayStack was chosen to avoid confusion with OpenGL display lists.
ofImage image;
ofxDisplayStackObject parent;
ofxDisplayStackObject child;
void ofApp::setup(){
image.load("image.png");
image.setAnchorPercent(0.5f, 0.5f);
parent.setBaseObject(&image);
child.setBaseObject(&image);
parent.pushChild(&child);
}
void ofApp::draw(){
parent.position.x = ofGetWidth() / 2;
parent.position.y = ofGetHeight() / 2;
child.position.x = 120;
parent.draw();
}Tested with openFrameworks 0.12.1 on macOS.
This addon comes from an older fixed-function OpenGL era. The current release replaces the addon-owned matrix and color calls with openFrameworks drawing helpers, but projects using programmable-renderer-only code should still test their exact render path.
The example includes the standard openFrameworks Makefile flow:
cd example
make Debug
make RunDebug