Skip to content

Instantly share code, notes, and snippets.

@moebiussurfing
Created November 28, 2019 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moebiussurfing/c3c47358b4c45d7ab0c512a286ff427f to your computer and use it in GitHub Desktop.
Save moebiussurfing/c3c47358b4c45d7ab0c512a286ff427f to your computer and use it in GitHub Desktop.
create gui from class params post glitch
std::map<std::string, RenderPass::Ptr> passes;
ofxPanel gui;
void toggleListener(const void * sender, bool & value);
@moebiussurfing
Copy link
Author

ofApp.cpp

...
post.createPass();
post.createPass();

gui.setup("panel");
gui.add(spread.set("spread", 100.0f, 50.0f, 300.0f));
gui.add(scale.set("scale", 20.0f, 20.0f, 200.0f));

...

for(auto & pass : post.getPasses()) {
    pass->setEnabled(false);
    ofParameter<bool> param;
    gui.add(param.set(pass->getName(), false));
    param.addListener(this, &ofApp::toggleListener);
    passes[pass->getName()] = pass;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment