Skip to content

paulobarcelos/ofxDisplayStackObject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ofxDisplayStackObject

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.

Usage

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();
}

Compatibility

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

About

openFrameworks addon for composing drawable objects in a lightweight Flash-style transform hierarchy.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors